It seems like Taurus doesn't work with promises correctly:
Issue 1: If I try to query for none existing candidate I would expect to handle the error in my subscription, however, the Taurus is throwing the error and it doesn't pass the error to subscription.
let record: Entity<Candidate> = new Entity(EntityTypes.Candidate).fields('id', 'name');
// use none existing canditate id
record.get(100);
record.subscribe((response) => {
console.log(record.data);
}, (error) => console.error('should print the error', error));
Error message:
(node:31240) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
at createError (/Users/martinmicunda/projects/bigbang/aviation-api.cae.com/node_modules/@bullhorn/taurus/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/martinmicunda/projects/bigbang/aviation-api.cae.com/node_modules/@bullhorn/taurus/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd (/Users/martinmicunda/projects/bigbang/aviation-api.cae.com/node_modules/@bullhorn/taurus/node_modules/axios/lib/adapters/http.js:192:11)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
(node:31240) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:31240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Issue 2: In my application I prefer to use Promises and not observables and as the observable has toPromise() the below code should work, however it seems like promise is lost somewehere
as console.log or console.error are not executed.
Hi @bvkimball
It seems like Taurus doesn't work with promises correctly:
Issue 1: If I try to query for none existing candidate I would expect to handle the error in my subscription, however, the Taurus is throwing the error and it doesn't pass the error to subscription.
Error message:
Issue 2: In my application I prefer to use
Promises
and notobservables
and as the observable hastoPromise()
the below code should work, however it seems like promise is lost somewehere asconsole.log
orconsole.error
are not executed.