Skip to content

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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions RandomTips.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ export function setContext(newContext) {
export async function showRandomTip() {
// only try to select tip, if one is even available
if (tips.length === 0) {
console.info("no tips to show available anymore");
return Promise.reject(new Error("no tips to show available anymore"));
console.trace("no tips to show available anymore");
return;
}

// randomly select element
Expand All @@ -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}

*/
export function showRandomTipIfWanted() {
saveConfig();

// randomize tip showing in general
if (!randomizePassed(GLOBAL_RANDOMIZE)) {
console.info("show no random tip, because randomize did not pass");
return Promise.reject(new Error("show no random tip, because randomize did not pass"));
console.trace("show no random tip, because randomize did not pass");
return;
}

return showRandomTip();
Expand Down