thinky icon indicating copy to clipboard operation
thinky copied to clipboard

removeRelation does not throw DocumentNotFound

Open gjuchault opened this issue 9 years ago • 2 comments

When you use removeRelation on a non-existant model, the user thrown is ReqlUserError but not a DocumentNotFound.

{ [ReqlUserError: The query did not find a document and returned null in:
   r.table("Group").get("00000000-0000-1000-8000-000000000000").default(r.error("The query did not find a document and returned null."))("id").do(function(var_1338) {
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                               
       return r.table("Group_User").getAll(var_1338.add("_").add("00000000-0000-1000-8000-000000000000"))
           .delete()
   })
   ]
     [stack]: [Getter/Setter],
     message: 'The query did not find a document and returned null in:\nr.table("Group").get("00000000-0000-1000-8000-000000000000").default(r.error("The query did not find a document and returned null."))("id").do(function(var_1338) {\n                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                               \n    return r.table("Group_User").getAll(var_1338.add("_").add("00000000-0000-1000-8000-000000000000"))\n        .delete()\n})\n',
     frames: [ 1, 0, 1, [length]: 3 ],
     name: 'ReqlUserError' }

gjuchault avatar Apr 26 '16 22:04 gjuchault

@neumino ?

gjuchault avatar May 14 '16 14:05 gjuchault

Yea, I think we just need to wrap errors in case a post validation is required

neumino avatar May 14 '16 18:05 neumino