Skip to content

Instantly share code, notes, and snippets.

@enkot
Last active August 20, 2018 13:34
Show Gist options
  • Save enkot/55bfe88711ec0462fd50fc8a06a21c37 to your computer and use it in GitHub Desktop.
Save enkot/55bfe88711ec0462fd50fc8a06a21c37 to your computer and use it in GitHub Desktop.
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