-
Notifications
You must be signed in to change notification settings - Fork 5
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
src: include error message when reporting failed R2 operations to sentry #82
Conversation
@@ -56,17 +56,21 @@ async function r2GetWithRetries( | |||
key: string, | |||
options?: R2GetOptions | |||
): Promise<R2Object | null> { | |||
let r2Error: unknown = undefined; |
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.
let r2Error: unknown = undefined; | |
let r2Error: Error; |
And no need to assign to undefined
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.
In a try/catch block whatever was thrown has the type of undefined
though?
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.
Hmm?
I mean that the default value of a let assignment will be undefined
, and the type of err on catch
in general is Error
even if it might not during runtime
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.
At least with the types I have the err type in a catch block is unknown
, to get it to an Error
we'd need to cast it
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.
Feel free to keep unknown then
a6b9c52
to
7f9ae9b
Compare
@flakey5 I saw you didnt remove the undefined assignments? |
Agh, the second time within a 24 hour period of not saving a file before committing it. I'll remove them later on in another pr for some code cleanup |
All good 🫶 |
No description provided.