Last active
August 20, 2018 13:34
-
-
Save enkot/55bfe88711ec0462fd50fc8a06a21c37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Catch(target, key, descriptor) { | |
const originalMethod = descriptor.value | |
descriptor.value = async function(...args) { | |
try { | |
return await originalMethod.apply(this, args) | |
} catch (error) { | |
console.warn(error.message) | |
Toast.error(error.message) | |
} | |
} | |
return descriptor | |
} | |
export default Catch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment