Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More docs on throwing errors

  • Loading branch information...
commit 952d1452ba5a2ea7231cb391f37fa6e766cbf37d 1 parent 3ff406a
@kriszyp kriszyp authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 README.md
View
14 README.md
@@ -199,6 +199,20 @@ are translated:
* RangeError - 416
* Other errors - 500 or if the error object has a "status" property, that will be used
+For example, if we had a model definition, we could throw a TypeError if the date
+property on PUT requests is not a valid date. This will result in a 403 response from the server
+to the client for PUT requests that violate this condition:
+
+ Purchase = Model(store, {
+ // we can define handlers
+ put: function(object, directives){
+ if(isNaN(new Date(object.date).getTime())){
+ throw new TypeError("Invalid date");
+ }
+ ...
+ }
+ });
+
Content Negotiation
===============
Please sign in to comment.
Something went wrong with that request. Please try again.