Skip to content
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

Error messages for deserialization failures and constraint violations #1379

Open
1 of 2 tasks
david-perez opened this issue May 9, 2022 · 2 comments
Open
1 of 2 tasks
Labels
server Rust server SDK

Comments

@david-perez
Copy link
Contributor

david-perez commented May 9, 2022

smithy-rs services have returned HTTP 400 since #1000 (v0.34.0) and an X-Amzn-Errortype header set to SerializationException since #1233 (v0.39.0).

We don't put detailed messages in the HTTP body, e.g. things like invalid character at line 5, character 3: expected START_ARRAY when the input data fails to deserialize, or things like:

{
    "message": "1 validation error detected. Value null at '/string' failed to satisfy constraint: Member must not be null",
    "fieldList": [
        {
            "message": "Value null at '/string' failed to satisfy constraint: Member must not be null",
            "path": "/string"
        }
    ]
}

(example protocol test)

when the input data does not satisfy a constraint.


This issue tracks:

  • better error messages for deserialization failures; and
  • better error messages for constraint violations.
@david-perez david-perez added the server Rust server SDK label May 9, 2022
@david-perez
Copy link
Contributor Author

Constraint violation error messages need implementation of constraint traits (pattern, range, length) as a prerequisite, for which #1342 first needs to land.

@spinski spinski added this to the Server GA milestone Nov 24, 2022
@jjant jjant moved this from To do to In progress in Server SDK (Developer preview) Jan 10, 2023
@jjant jjant self-assigned this Jan 10, 2023
@jjant jjant moved this from In progress to To do in Server SDK (Developer preview) Jan 10, 2023
@david-perez
Copy link
Contributor Author

I've ticked off the second item; since 0.52 we now return ValidationExceptions in responses when constraint traits are not honored.

Only pending thing to close this is provide better error messages for deserialization failures things like e.g. invalid character at line 5, character 3: expected START_ARRAY when parsing invalid JSON.

@spinski spinski removed this from the Server GA milestone Jan 31, 2023
@jjant jjant removed their assignment May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Rust server SDK
Projects
None yet
Development

No branches or pull requests

3 participants