diff options
author | Loïc Hoguin <[email protected]> | 2016-08-29 12:39:49 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-29 12:40:03 +0200 |
commit | c807880f7ac73f813b2660ea81a00f7712a4e793 (patch) | |
tree | ba1d09e9b177f230665a80513b33fbd532000ce4 /_build/static/archives/extend/2013-October/000288.html | |
parent | b1df25a7d9cda697513650659b781b55b40898f8 (diff) | |
download | ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.gz ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.bz2 ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.zip |
Add old mailing list archives
Diffstat (limited to '_build/static/archives/extend/2013-October/000288.html')
-rw-r--r-- | _build/static/archives/extend/2013-October/000288.html | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/_build/static/archives/extend/2013-October/000288.html b/_build/static/archives/extend/2013-October/000288.html new file mode 100644 index 00000000..50c515f5 --- /dev/null +++ b/_build/static/archives/extend/2013-October/000288.html @@ -0,0 +1,110 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] REST handler failure + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20REST%20handler%20failure&In-Reply-To=%3C0F1D01F5-A4B3-4135-8F4C-FCC2E9F79DFA%40llaisdy.com%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="000287.html"> + <LINK REL="Next" HREF="000289.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] REST handler failure</H1> + <B>Ivan uemlianin</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20REST%20handler%20failure&In-Reply-To=%3C0F1D01F5-A4B3-4135-8F4C-FCC2E9F79DFA%40llaisdy.com%3E" + TITLE="[99s-extend] REST handler failure">ivan at llaisdy.com + </A><BR> + <I>Tue Oct 29 22:01:30 CET 2013</I> + <P><UL> + <LI>Previous message: <A HREF="000287.html">[99s-extend] REST handler failure +</A></li> + <LI>Next message: <A HREF="000289.html">[99s-extend] REST handler failure +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#288">[ date ]</a> + <a href="thread.html#288">[ thread ]</a> + <a href="subject.html#288">[ subject ]</a> + <a href="author.html#288">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Sorry for terse but I only have a phone. Why can't you return a 404 here? Using something like cowboy:reply(404, ... + +Ivan + +-- +festina lente + + +On 29 Oct 2013, at 21:25, Daniel Goertzen <<A HREF="https://lists.ninenines.eu/listinfo/extend">daniel.goertzen at gmail.com</A>> wrote: + +><i> My situation is that I have a rest handler that may fail due to invalid url segments. Example situation: +</I>><i> +</I>><i> +</I>><i> init(_Transport, _Req, _Opts) -> +</I>><i> {upgrade, protocol, cowboy_rest}. +</I>><i> +</I>><i> content_types_provided(Req, State) -> +</I>><i> {[{<<"application/json">>, get_json}], Req, State}. +</I>><i> +</I>><i> get_json(Req0, State) -> +</I>><i> {Params, Req1} = lists:mapfoldl(fun cowboy_req:binding/2, Req0, [param1, param2, param3, ....]), +</I>><i> +</I>><i> case catch other_module:request(Params) of +</I>><i> {'EXIT', {badarg, _}} -> +</I>><i> hmmm, Params were bad and I would like to return a 404 code now. +</I>><i> Result -> +</I>><i> {jiffy:encode(Result), Req1, State} +</I>><i> end. +</I>><i> +</I>><i> +</I>><i> +</I>><i> So I would like to return a 404 code when my underlying request function fails, but it appears my choices are: +</I>><i> +</I>><i> - return a 200 (ok) response with data. +</I>><i> - crash and cause a 500 (Internal Server Error) response to be returned. Not exactly the sentiment I want. +</I>><i> +</I>><i> +</I>><i> Is there some other way to cause a 404 response? +</I>><i> +</I>><i> I realize I could add path constraint functions, but I will be replicating logic from my underlying request function. Furthermore, the constraint functions consider parameters in isolation, so that won't work if the validity of parameters is coupled. +</I>><i> +</I>><i> Thanks, +</I>><i> Dan. +</I>><i> _______________________________________________ +</I>><i> Extend mailing list +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A> +</I>><i> <A HREF="http://lists.ninenines.eu:81/listinfo/extend">http://lists.ninenines.eu:81/listinfo/extend</A> +</I>-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20131029/3df30c1d/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20131029/3df30c1d/attachment.html</A>> +</PRE> + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000287.html">[99s-extend] REST handler failure +</A></li> + <LI>Next message: <A HREF="000289.html">[99s-extend] REST handler failure +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#288">[ date ]</a> + <a href="thread.html#288">[ thread ]</a> + <a href="subject.html#288">[ subject ]</a> + <a href="author.html#288">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> |