blob: bfebf6d7256e2d9b5653744a481e0057fdc4eb66 (
plain) (
tree)
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [99s-extend] Arbitrary 500 from REST handler?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Arbitrary%20500%20from%20REST%20handler%3F&In-Reply-To=%3C512677BB.6030004%40ninenines.eu%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000062.html">
<LINK REL="Next" HREF="000064.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[99s-extend] Arbitrary 500 from REST handler?</H1>
<B>Loïc Hoguin</B>
<A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Arbitrary%20500%20from%20REST%20handler%3F&In-Reply-To=%3C512677BB.6030004%40ninenines.eu%3E"
TITLE="[99s-extend] Arbitrary 500 from REST handler?">essen at ninenines.eu
</A><BR>
<I>Thu Feb 21 20:38:35 CET 2013</I>
<P><UL>
<LI>Previous message: <A HREF="000062.html">[99s-extend] Arbitrary 500 from REST handler?
</A></li>
<LI>Next message: <A HREF="000064.html">[99s-extend] Cowboy 0.8.1
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#63">[ date ]</a>
<a href="thread.html#63">[ thread ]</a>
<a href="subject.html#63">[ subject ]</a>
<a href="author.html#63">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On 02/21/2013 08:29 PM, Phillips, Christopher wrote:
><i>
</I>><i> I have a case where I am creating a resource through a POST. There
</I>><i> are a number of places where the create can fail in a known manner, and
</I>><i> we need to alert the user to the specifics of why. Is there a way to
</I>><i> throw an arbitrary 500, with message, from within the REST handler? I
</I>><i> can obviously just erlang:error(whatever), but the message content is
</I>><i> ignored, and there is no way to pass back an updated response when doing
</I>><i> that.
</I>
Use cowboy_req:reply and then return {halt, Req2, State} to stop execution.
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
<A HREF="http://ninenines.eu">http://ninenines.eu</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000062.html">[99s-extend] Arbitrary 500 from REST handler?
</A></li>
<LI>Next message: <A HREF="000064.html">[99s-extend] Cowboy 0.8.1
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#63">[ date ]</a>
<a href="thread.html#63">[ thread ]</a>
<a href="subject.html#63">[ subject ]</a>
<a href="author.html#63">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>
|