Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: alert message bug #23

Merged
merged 2 commits into from
Jan 25, 2024
Merged

Conversation

maryam4s26
Copy link
Contributor

@maryam4s26 maryam4s26 commented Jan 23, 2024

This PR solves the bug resulting from displaying the error alert message in different browsers. os-js/osjs-client#212

@andersevenrud
Copy link
Member

Does the .message always contain the same info from .stack ?

@maryam4s26
Copy link
Contributor Author

@andersevenrud

Do you think this is true?

        const msg = error instanceof Error
          ? error.stack
            ? error.message
              ? error.message
              : error.stack
            : error
          : String(error);

@andersevenrud
Copy link
Member

I feel like this can just be simplified to something like this:

        const msg = error instanceof Error ? `${error.message}\n\n${error.stack || 'No stack'}` : error

Basically just "dump" it without any logic.

Copy link
Member

@andersevenrud andersevenrud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Could you attach a screenshot to verify the changes ? I'm unable to test this myself because I'm away.

@maryam4s26
Copy link
Contributor Author

Looks good to me!

Could you attach a screenshot to verify the changes ? I'm unable to test this myself because I'm away.

yes. sure.

Screenshot from 2024-01-25 22-27-11
Screenshot from 2024-01-25 22-27-11

@andersevenrud andersevenrud merged commit a088171 into os-js:master Jan 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants