[Dancer-users] Confused on error reporting

Stephen Fenwick-Paul stephen at activeg.org
Thu Jul 7 21:36:57 CEST 2011

Thanks for the replies. I think I've not explained myself well.

I don't expect the backtrace to be shown or any internal error in production
mode, but I do need to be able to pass back to users of the system some
meaningful message on why their called failed.

Such as "Sorry we have experienced a system failure - please try again
later. Your problem has need reported" for a 500, or "Sorry you have not
sent the mandatory argument 'type'" or "Sorry, the argument 'ditsance' is
not understood." for a 400.

How do I get such messages back to the caller, be it a web page, or
most problematically a RESTful user using JSON and still re ponded with a
meaningful code.

I could catch all errors, and send back a nice HTML or JSON object, but my
response would be a 200 which seems wrong.

At present the poor user can not tell why his requests are failing.

thanks again for an guidance.


On Thu, Jul 7, 2011 at 3:04 PM, Flavio Poletti <polettix at gmail.com> wrote:

> I would also add that this choice is wise, because showing such internal
> info to the end user in a production environment is likely to be frown
> during a security audit.
> Of course this is a general statement that does not take into account what
> Stephen might have read about how RESTful apps should respond to errors, but
> I would be surprised of the contrary.
> Cheers,
>     Flavio.
> On Thu, Jul 7, 2011 at 1:44 PM, Takeshi OKURA <okura3 at gmail.com> wrote:
>> Hi Stephen.
>> 2011/7/7 Stephen Fenwick-Paul <stephen at activeg.org>:
>> > With the environment set to development, each of these responds as I
>> expect.
>> > Case 1 gives me a full backtrace, case 2 gives me a a json with just the
>> > error message, and case 3 again give me a full backtrace,
>> > Now moving to the production environment. I get
>> (snip)
>> > Which is OK, but where is the meaningful message to the user gone?
>> To show the stack trace, show_errors variable in a
>> environment/production.yml shuld be 1. I think so.
>> It's 1 in development.yml. But in production.yml It's 0.
>> best regards.
>> --
>> Takeshi OKURA
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110707/e77b41d2/attachment.htm>

More information about the Dancer-users mailing list