Created
April 22, 2018 19:24
-
-
Save dillonchanis/3883105d0e6fda2ed9c100d4a494b2a3 to your computer and use it in GitHub Desktop.
Simple Error Boundary
This file contains 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
export default { | |
name: 'ErrorBoundary', | |
data: () => ({ | |
error: false | |
}), | |
errorCaptured (err, vm, info) { | |
this.error = true | |
}, | |
render (h) { | |
return this.error ? h('p', 'Something went wrong') : this.$slots.default[0] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment