2
0
mirror of synced 2025-01-11 06:35:51 +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
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);
});