You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/02/24 19:26:04 UTC

[GitHub] [incubator-superset] craig-rueda commented on issue #9194: [SIP-40] Proposal for Custom Error Messages

craig-rueda commented on issue #9194: [SIP-40] Proposal for Custom Error Messages
URL: https://github.com/apache/incubator-superset/issues/9194#issuecomment-590505746
 
 
   @etr2460, this is great. It looks like a step towards getting all API responses to have a standard shape. One thing that I would change a tiny bit would be the response shape. Enums are awesome for this sort of thing, but one thing I would add would be an error "code" which would simply be an `int` which can then be taken action upon by the consumer. There's also the potential for having multiple errors in a given response (think API validation where several keys are required). In my view, Enum names should be used solely for the purpose of code organization, and should not be transmitted to consumers. Instead, error state should depend on the "error code".
   
   A slight variation to your structure:
   ```
   {
       "errors": [{
          "code": 123,
          "message": "Something is wrong here",
          "extra": {
              // Additional contextual stuff in here, for instance field validation messages
          }
       }]
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org