Permalink
Browse files

Handle POST errors appropriately.

  • Loading branch information...
1 parent 0d7c50a commit 61c3c3ef931b48c4b0bbd76f5074f5d6819f875e @zeekay committed Aug 1, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/index.coffee
View
@@ -16,6 +16,10 @@ createRoutes = (Model) ->
doc.save (err) =>
if not err
@json doc, 201
+ else if err.code == 11000
+ @json doc, 202
+ else
+ @json 500
# List
@get "/api/#{plural}", ->

0 comments on commit 61c3c3e

Please sign in to comment.