amzn / smoke-framework

A light-weight server-side service framework written in the Swift programming language.
Apache License 2.0
1.44k stars 41 forks source link

Provide more descriptive messages from decoding errors. #110

Closed tachyonics closed 2 years ago

tachyonics commented 2 years ago

Issue #, if available:

Description of changes: Provide more descriptive messages from decoding errors rather than just providing the raw Swift error structure-

{
  "__type" : "DecodingError",
  "message" : "No value associated with key CodingKeys(stringValue: \"theAttribute\", intValue: nil) (\"theAttribute\")."
}

Instead

{
  "__type" : "DecodingError",
  "message" : "Key not found at path 'theAttribute'."
}
{
  "__type" : "DecodingError",
  "message" : "Required value not found at path 'container.theAttribute'."
}
{
  "__type" : "DecodingError",
  "message" : "Data corrupted at path 'regions[1]'. Cannot initialize Region from invalid String value HAHA."
}
{
  "__type" : "DecodingError",
  "message" : "Incorrect type at path 'theAttribute'. Expected String."
}

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.