1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Replace Bluebird.try

This commit is contained in:
Michael Telatynski
2019-11-25 14:22:07 +00:00
parent f8d83f8273
commit fddf2843b4
3 changed files with 17 additions and 7 deletions

View File

@@ -737,3 +737,13 @@ module.exports.promiseMapSeries = async (promises, fn) => {
await fn(await o);
}
};
module.exports.promiseTry = (fn) => {
return new Promise((resolve, reject) => {
try {
fn().then(resolve, reject);
} catch (e) {
reject(e);
}
});
};