From: adam Date: Thu, 19 Oct 2006 22:58:37 +0000 (+0000) Subject: Changed the 4xx status helpers to return error objects X-Git-Tag: 1.08~293 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bdc54939efa0a9cd664a10e5ae4241b69d9956de;p=catagits%2FCatalyst-Action-Serialize-Data-Serializer.git Changed the 4xx status helpers to return error objects --- diff --git a/Changelog b/Changelog index 394952e..31cffc2 100644 --- a/Changelog +++ b/Changelog @@ -7,3 +7,7 @@ Mon Oct 16 14:48:54 PDT 2006 (adam) Wed Oct 18 17:29:07 PDT 2006 (adam) Added more status_ helpers +Thu Oct 19 16:04:33 PDT 2006 (adam) + Converted error helpers to return an object instead of plain-text. It's + a more consistent model than a text/plain error message. + diff --git a/lib/Catalyst/Controller/REST.pm b/lib/Catalyst/Controller/REST.pm index 33ef165..321037a 100644 --- a/lib/Catalyst/Controller/REST.pm +++ b/lib/Catalyst/Controller/REST.pm @@ -71,8 +71,7 @@ sub status_bad_request { ); $c->response->status(400); - $c->response->content_type('text/plain'); - $c->response->body($p{'message'}); + $self->_set_entity($c, { error => $p{'message'} }); return 1; } @@ -86,8 +85,7 @@ sub status_not_found { ); $c->response->status(404); - $c->response->content_type('text/plain'); - $c->response->body($p{'message'}); + $self->_set_entity($c, { error => $p{'message'} }); return 1; }