Skip to content

How to type-annotate ServiceErrors #1170

Answered by ysaito1001
michaelrommel asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for taking time to clarify your use case.

What I wanted to achive is to get access to the underlying reason, so that I can programmatically tell the user what to do

Sounds like you wish to write an error handling code with a match expression that has arms based on the underlying error reasons?

One thing to note is that the errors you shared with us above indicate they are wrapped in DispatchError, which is an informative error. You can take a look at this RFC for more details, but the gist is that there are two broad categories of errors in the SDK, actionable and informative. It makes sense to write a match expression on the former but makes less sense to do so with the latte…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ysaito1001
Comment options

Answer selected by michaelrommel
@michaelrommel
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants