Permalink
Browse files

Fix error serialization

  • Loading branch information...
kriszyp committed Jul 1, 2011
1 parent 3c8f352 commit 1859bb2ed884b40b43a52dea4e527ae56b24d8e3
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/media/html.js
View
@@ -7,14 +7,18 @@ Media({
return 1;
},
serialize: function(object, parameters, request, response){
- var response = publicStatic({pathInfo:"/list.html", headers:{}, method: "GET"});
- return {
- forEach: function(callback){
- return response.then(function(response){
- return response.body.forEach(callback);
- });
- }
- };
+ if(response.status == 200){
+ var response = publicStatic({pathInfo:"/list.html", headers:{}, method: "GET"});
+ return {
+ forEach: function(callback){
+ return response.then(function(response){
+ return response.body.forEach(callback);
+ });
+ }
+ };
+ }else{
+ return response.body;
+ }
}
});

0 comments on commit 1859bb2

Please sign in to comment.