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

Emit console.trace instead of throwing errors for non-critical stuff #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rugk
Copy link
Member

@rugk rugk commented Aug 22, 2022

Fixes #7

The issue is here that a promise is usually expected, so I cannot just return
Promise.ject() with an empty error, because this also results in a red error
for the promise (with the worse error message "undefined").

Thus I've just made it to return a successful promise or undefined.

I've also changed the similar uncritical error when tips should be shown
according to gobal randomize, but no tip could be shown due to other factors,
so there is no tip to be shown.

Console.trace is BTW well-supported across browsers:
https://developer.mozilla.org/en-US/docs/Web/API/console/trace#browser_compatibility

Fixes #7

The issue is here that a promise is usually expected, so I cannot just return
Promise.ject() with an empty error, because this also results in a red error
for the promise (with the worse error message "undefined").

Thus I've just made it to return a successful promise or undefined.

I've also changed the similar uncritical error when tips should be shown
according to gobal randomize, but no tip could be shown due to other factors,
so there is no tip to be shown.

Console.trace is BTW well-supported across browsers:
https://developer.mozilla.org/en-US/docs/Web/API/console/trace#browser_compatibility
@rugk
Copy link
Member Author

rugk commented Aug 22, 2022

/cc @tdulcet feel free to review

@@ -322,15 +322,15 @@ export async function showRandomTip() {
* Shows the random tip only randomly so the user is not annoyed.
*
* @public
* @returns {Promise}
* @returns {Promise | undefined}
Copy link

Choose a reason for hiding this comment

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

I believe the TypeScript compiler would complain about this...

Suggested change
* @returns {Promise | undefined}
* @returns {Promise<void> | void}

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.

Error: show no random tip, because randomize did not pass is not an error
2 participants