"Uncaught Error: Operation not permitted" should be catchable
Author: lgastakoCreated Oct 15, 2016Updated Apr 27, 2020
Server version: 2.0.0-beta-7 Client version: 2.0.0-beta-7
I am executing a query like this:
try {
log("saving...");
(hz("table")
.store(record)
.subscribe(function success(result) {
log("ok => "+ show(result));
// ... use result here ....
}, function failure(err) {
log("err => " + show(err));
// ... handle error here ...
}));
} catch (ex) {
log("boom - error saving record");
console.error(ex);
}And I see "saving..." but then no "ok", "err", or "boom" and then get this error uncaught at the top level:
Uncaught Error: Operation not permitted.
next @ ast.js:283
e.__tryOrUnsub @ Subscriber.js:223
e.next @ Subscriber.js:172
e._next @ Subscriber.js:125
e.next @ Subscriber.js:89
e.nextOrComplete @ takeWhile.js:84
e._next @ takeWhile.js:79
e.next @ Subscriber.js:89
e._next @ Subscriber.js:125
e.next @ Subscriber.js:89
e.next @ Subject.js:55
e._next @ Subscriber.js:125
e.next @ Subscriber.js:89
e.notifyNext @ mergeMap.js:133
e._next @ InnerSubscriber.js:23
e.next @ Subscriber.js:89
u @ subscribeToResult.js:26
e._innerSub @ mergeMap.js:120
e._tryNext @ mergeMap.js:117
e._next @ mergeMap.js:100
e.next @ Subscriber.js:89
e.notifyNext @ OuterSubscriber.js:19
e._next @ InnerSubscriber.js:23
e.next @ Subscriber.js:89
(anonymous function) @ WebSocketSubject.js:79
e.__tryOrUnsub @ Subscriber.js:223
e.next @ Subscriber.js:172
e._next @ Subscriber.js:125
e.next @ Subscriber.js:89
e.next @ Subject.js:55
r.onmessage @ WebSocketSubject.js:160NB. None of that is code that is in my control.
I would expect this to come back in the failure branch of the subscription, or at the very least be able to be handled somehow. The Operation not permitted error is correct -- the thing I am testing that is causing this error is trying to create to items with the same primary key -- it's correctly failing the second one but I of course want to be able to handle this and gracefully report to the user that the key is already taken.
Source: rethinkdb/horizon