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

Provide a way to override lambda's errorous http status code #179

Open
2 tasks
limouren opened this issue Jan 31, 2018 · 0 comments
Open
2 tasks

Provide a way to override lambda's errorous http status code #179

limouren opened this issue Jan 31, 2018 · 0 comments

Comments

@limouren
Copy link
Contributor

Currently in py-skygear, SkygearException allows us to cusomize an error response:

    raise SkygearException(
        code=9999,
        message='Something has gone wrong. Handle it in client side.',
        info={},
    )

It would produce a http response like this:

HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Length: 142
Content-Type: application/json
Date: Wed, 31 Jan 2018 14:14:35 GMT
Server: Skygear Server/1.2.0-31-g68cb380

{
    "error": {
        "code": 9999, 
        "message": "You have done something wrong. Handle it in client side.", 
        "name": "ErrorCode(9999)"
    }
}

Note that skygear always returns a 500, while such errors are typically a 4xx. It would be great if skygear could provide a way for dev to decide a different http status code to provide better semantics for their API.

  • Skygear Server Date/Version: v1.3.1
  • Application Platform: go, python
  • Is this a regression?
  • Attached logs, screenshots

Expected Results

Actual Results

Steps to reproduce

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

No branches or pull requests

1 participant