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

Restup.Webserver.Models.Schemas.GetResponse.ResponseStatus needs an error #99

Open
ghost opened this issue Dec 1, 2016 · 3 comments
Open
Labels

Comments

@ghost
Copy link

ghost commented Dec 1, 2016

    public enum ResponseStatus
    {
        OK = 200,
        NotFound = 404
        Error = 500
    }

(you could also fill out that graph with a whole host of others....

Love the code... So far works really well. I'll let you know if I come upon anything else.

@tomkuijsten
Copy link
Owner

tomkuijsten commented Dec 2, 2016

We could ofcourse extend that list with all possible HTTP status, but these are the only viable ones as a response to a GET request.

If you want an error response, you can just throw an exception and it will generate a 400 error.

Hope that helps you.

@Jark
Copy link
Collaborator

Jark commented Dec 2, 2016

I think it's easier to understand if you think of the IGetResponse, IPostResponse, IPutResponse, IDeleteResponse as the response to the intent of the request.

Imo we should expand the error codes slightly for the IPostResponse / IPutResponse (Unauthorized, for example) to represent more clearer error intentions, but for the GetResponse I think we've covered them.

@tomkuijsten as a side note it might be nice to add a BadRequestException that will convert into a 400 error and any other unhandled exceptions can then be converted to 500 (InternalServerError). This might capture what a user might expect better.

@tomkuijsten
Copy link
Owner

Might be a good idea to add something as a ErrorResponse (instead of an exception) which can always be returned with a error code > 400. Let's create an issue for this to design the thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants