2
0
mirror of synced 2025-01-25 22:00:22 +00:00

js: fixed promise rejected with non-error warning

This commit is contained in:
Salakar 2017-03-07 17:02:24 +00:00
parent 9b5aaae909
commit a3f3cf930a

View File

@ -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);
}); });