You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
simplify promiseTry
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -738,11 +738,5 @@ module.exports.promiseMapSeries = async (promises, fn) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.promiseTry = (fn) => {
|
module.exports.promiseTry = (fn) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => resolve(fn()));
|
||||||
try {
|
|
||||||
fn().then(resolve, reject);
|
|
||||||
} catch (e) {
|
|
||||||
reject(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user