[99s-extend] Arbitrary 500 from REST handler?
Loïc Hoguin
essen at ninenines.eu
Thu Feb 21 20:38:35 CET 2013
On 02/21/2013 08:29 PM, Phillips, Christopher wrote:
>
> I have a case where I am creating a resource through a POST. There
> are a number of places where the create can fail in a known manner, and
> we need to alert the user to the specifics of why. Is there a way to
> throw an arbitrary 500, with message, from within the REST handler? I
> can obviously just erlang:error(whatever), but the message content is
> ignored, and there is no way to pass back an updated response when doing
> that.
Use cowboy_req:reply and then return {halt, Req2, State} to stop execution.
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu
More information about the Extend
mailing list