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
|
||||
setImmediate(() => {
|
||||
if (err) {
|
||||
return reject(errorPrefix ? {
|
||||
code: toWebSDKErrorCode(err.code || err.errCode || err.errorCode || '', errorPrefix),
|
||||
message: err.message,
|
||||
} : err);
|
||||
const firebaseError = new Error(err.message);
|
||||
firebaseError.code = toWebSDKErrorCode(err.code || err.errCode || err.errorCode || '', errorPrefix);
|
||||
return reject(errorPrefix ? firebaseError : err);
|
||||
}
|
||||
return resolve(resp);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user