Error Messages, "Message" field question.
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
When / Why was the class name of a Chalice Error added to the actual HTTP response sent by API GW.
IMO it adds an unnecessary and redundant piece of information to strip out of the JSON response. The "Code" field already contains the class name so now we have it again the Message field.
Relevant snippet:
```
class ChaliceViewError(ChaliceError):
STATUS_CODE = 500
def __init__(self, msg=''):
super(ChaliceViewError, self).__init__(
self.__class__.__name__ + ': %s' % msg)
```
Proposal, revert back to only containing the actual user provided message and drop the redundant class name. FWIW the docs still have the "old" style of this:
```
$ chalice deploy
$ http https://endpoint/api/cities/vancouver
HTTP/1.1 400 Bad Request
{
"Code": "BadRequestError",
"Message": "Unknown city 'vancouver', valid choices are: portland, seattle"
}
```
Contributor guide
Research direction
Start at the shown ChaliceViewError.__init__ implementation and compare its output with the documented API Gateway response. Done means the HTTP error's Message contains only the user-provided message, while Code still identifies the error class and the documentation example remains accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100