RejectedSoftware Forums

Sign up

REST Responses

Can I create custom responses using the REST interface capabilities? I have a POST and GET working, but I'd like to be able to leverage the status codes to alert the user to success, created, no content, errors, etc.

Or, am I in for a world of hurt?

Re: REST Responses

Am 28.11.2012 23:21, schrieb Casey:

Can I create custom responses using the REST interface capabilities? I have a POST and GET working,
but I'd like to be able to leverage the status codes to alert the user to success, created, no
content, errors, etc.

Or, am I in for a world of hurt?

You can throw a vibe.http.server.HttpStatusException for custom error responses.

Ideally, I would like to have a hierarchy of standard exceptions that are recognized and converted
to the proper HTTP response, but Phobos doesn't have this and I didn't want to create an proprietary
hierarchy for this.