I just want to ask how should I pass the resolve promise to catch
if the value on the resolve is not intended.
e.g.
let prom = getPromise();
prom.then(value => {
if (value.notIWant) {
// Send to catch <-- my question is here, I want to pass it on the catch.
}
// Process data.
}).catch(err => {
// Pass the error through ipc using json, for logging.
});
I tried to using throw
but the object cant be parsed to json and just got an empty object.
ANSWER:
@BohdanKhodakivskyi first comment below is the answer I want.
@31py answer is also correct but the @BohdanKhodakivskyi solution is much simplier and will render the same result.