You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...wouldn't it make sense to improve our custom error messages to use that name? For instance (and the most practical example), when a document can't be found - I think "The Vegetable couldn't be found." is a much clearer error message than "The query did not find a document and returned null.". This would be particularly useful when you have multiple chained lookups, and you need to know which of them couldn't be found:
Fruit.get(req.params.fruitId).then(()=>{Vegetable.get(req.params.vegetableId).then(()=>{Candy.get(req.params.candyId).then(()=>{returnres.json({message: "Everything was found! :)"});}).error(next);}).error(next);}).error(next);
Anyone else think this feature would be a good idea? I started looking at /lib/errors.js, but I'm not sure how we could access the actual model attributes from that class 🙁 .
The text was updated successfully, but these errors were encountered:
Update: This would of course only apply to Thinky error messages, not errors from the RethinkDB driver. The way I currently do it is similar to the following code, but it's not ideal:
Since we store the name of a model when it's defined:
...wouldn't it make sense to improve our custom error messages to use that name? For instance (and the most practical example), when a document can't be found - I think "The Vegetable couldn't be found." is a much clearer error message than "The query did not find a document and returned null.". This would be particularly useful when you have multiple chained lookups, and you need to know which of them couldn't be found:
Anyone else think this feature would be a good idea? I started looking at
/lib/errors.js
, but I'm not sure how we could access the actual model attributes from that class 🙁 .The text was updated successfully, but these errors were encountered: