-
Notifications
You must be signed in to change notification settings - Fork 193
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
chore: refactor actions and add tests #2015
Conversation
🚀 Thanks for the pull request! Here are the current build files for testing: Download and unzip the file for your browser. Refer to the readme for detailed install instructions. This build is brought to you by: Want to sponsor the next build? send some sats to ⚡️builds@getalby.com (don't forget to provide your name) Don't forget: keep earning sats! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utack
@@ -20,7 +21,9 @@ const makeInvoice = async (message, sender) => { | |||
}); | |||
return response; | |||
} catch (e) { | |||
return { error: e.message }; | |||
if (e instanceof Error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if e is not an Error? will this exception be swallowed?
I think it would be great to have a helper function we can use to get a message from an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you mention this recently somewhere else? Wanna create an issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of TypeScript; it should always be an error (according to the makeInvoice function)
But yeah, we use this repeatedly and it's best to have a helper function which somehow extracts the message from exception var. Not sure how we do that, though.
Describe the changes you have made in this PR
Adds tests to actions in the background-script
Migrates actions to TypeScript
Type of change
chore
: Refactoring (non-breaking change to the code)How has this been tested?
Wrote unit tests
Checklist