Skip to content

Add expectations for default member deser #365

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

Merged
merged 1 commit into from
Jul 1, 2021

Conversation

JordonPhillips
Copy link
Contributor

@JordonPhillips JordonPhillips commented Jun 23, 2021

This adds expectations for the default member deserialization so that an error will be thrown if the type being deserialized isn't correct.

See aws/aws-sdk-js-v3#2515 for the other half of this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@adamthom-amzn adamthom-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in services, won't TypeError become InternalFailure for service callers? Can we reliably turn that into SerializationException?

@JordonPhillips
Copy link
Contributor Author

We'd have to handle that separately from the InternalFailure wrapping. We could also have InternalFailure embed the error that caused it so we could unpack it.

@adamthom-amzn
Copy link
Contributor

I think a TypeError emerging from deserialization code could be wrapped in a SerializationException without having to go through InternalFailure. The only concern would be whether or not we could also reuse the message in the TypeError for the SerializationException (eventually, I didn't define a message at first, whoops). We would have to be sure that nothing else could throw a TypeError with a message we didn't want customers to receive. That consideration may make us choose a different TypeError, or a specialized subclass of it.

@JordonPhillips JordonPhillips force-pushed the expect-parse branch 2 times, most recently from cc59bc0 to ab89139 Compare June 25, 2021 17:51
This adds expectations for the default member deserialization so that
an error will be thrown if the type being deserialized isn't correct.
@trivikr trivikr merged commit 522066c into smithy-lang:main Jul 1, 2021
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
This adds expectations for the default member deserialization so that
an error will be thrown if the type being deserialized isn't correct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants