js: fixed promise rejected with non-error warning
This commit is contained in:
parent
9b5aaae909
commit
a3f3cf930a
@ -8,10 +8,9 @@ const _handler = (resolve, reject, errorPrefix, err, resp) => {
|
|||||||
// resolve / reject after events etc
|
// resolve / reject after events etc
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(errorPrefix ? {
|
const firebaseError = new Error(err.message);
|
||||||
code: toWebSDKErrorCode(err.code || err.errCode || err.errorCode || '', errorPrefix),
|
firebaseError.code = toWebSDKErrorCode(err.code || err.errCode || err.errorCode || '', errorPrefix);
|
||||||
message: err.message,
|
return reject(errorPrefix ? firebaseError : err);
|
||||||
} : err);
|
|
||||||
}
|
}
|
||||||
return resolve(resp);
|
return resolve(resp);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user