-
Notifications
You must be signed in to change notification settings - Fork 71
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
Best-effort error-decoding fix #357
Conversation
Baccata
commented
Aug 9, 2022
•
edited
Loading
edited
Now, when a client gets an unsuccessful response from a server, it'll try to inspect the X-Error-Type header first, and then will try to match the received status code against the errors it knows about (provided the code in question is uniquely used) If the client cannot infer a unique alternative based on this information, it'll raise a generic "UnknownErrorResponse"
@@ -24,6 +24,14 @@ final case class ShapeId(namespace: String, name: String) extends HasId { | |||
} | |||
|
|||
object ShapeId extends ShapeTag.Has[ShapeId] { | |||
def parse(string: String): Option[ShapeId] = { |
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.
if we really need this, I suggest we implemente it on top of ShapeId.from(s: String)
from smithy-model itself. You may need to catch ShapeIdSyntaxException
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.
smithy4s-core cannot depend on smithy-model, as it's a java-only library. Also it'd be pretty overkill to pull smithy-model for a single method.
I'm having trouble figuring out what exactly changes from before just by looking at the code. can you help me out here? |
There is support for the |
@daddykotex sure. So the behaviour change is that now, if we can't discriminate by neither The previous behaviour was only matching the name of the error in |
Ah ok, that was my high level understanding of what we had discussed. Makes sense to me. |
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.
LGTM,
thanks for the cleanup of my code :D