-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Error when catch exceptions in Vue components #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I created this simple example and it works just fine. <!doctype html>
<html>
<body>
<div id="app">
<clock-x></clock-x>
</div>
<script src="bundle.js"></script>
</body>
</html> import Vue from 'vue'
import Raven from 'raven-js'
import RavenVue from 'raven-js/plugins/vue'
Raven.config('https://[email protected]/1', {
dataCallback: function (data) {
console.log(data);
return data;
}
})
.addPlugin(RavenVue, Vue)
.install();
Vue.component('clock-x', {
data() {
return {
currentTime: +new Date()
}
},
template: `<div>
{{ currentTime }}
<button v-on:click="updateTime">Update time</button>
</div>`,
methods: {
updateTime() {
this.currentTime = +new Date()
throw new Error('Time is irrelevant')
}
}
})
new Vue({
el: '#app'
}); Can you please provide reproducible code example? |
Please feel free to reopen if this is still the case. |
Hi, I have the same problem. I have this problem only on IE (11 in my case), but I can't reproduce the bug on a jsfiddle. Reproduction does not seem important, because it seems to happen during problems with Vue.js (therefore not a real RavenJS issue). The problem being that Vue.js still reports the problem (using the I edited your library to add some logs: function vuePlugin(Raven, Vue) {
// ...
Vue.config.errorHandler = function VueErrorHandler(error, vm, info) {
console.error('call::VueErrorHandler, error.stack:', error.stack)
console.error('call::VueErrorHandler, vm:', vm)
console.error('call::VueErrorHandler, info:', info)
var metaData = {
componentName: formatComponentName(vm),
propsData: vm.$options.propsData
};
// ...
};
} And here is the result:
I apologize for this formatting, but IE doesn't help me very much, and I can't reproduce this problem anywhere but on my project. In any case, even if the error may be caused by Vue.js, RavenJS should not crash and handle the case of wrong parameters. |
@Dewep what version of Vue are you using? We had a similar issue before, and we got a note that it should be fixed in Vue 2.5.0 – #1061 (comment) |
Hi, {
"dependencies": {
// ...
"raven-js": "3.19.1",
"vue": "2.5.2",
"vue-router": "3.0.1",
"vuex": "3.0.0",
// ...
}
} |
@Dewep you can verify if your issue has been fixed updating your
|
Well, I'm not sure that's the perfect solution. As you would expect, RavenJS doesn't crash anymore, but the error is not reported. We would like to be informed when the application is dead for our customers. :) |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
I'm using Chrome 60. I'm adding Sentry support to Vue SPA, using Raven 3.17.0.
I install Raven from npm and init it in my index.js, right before creating Vue application, i.e.
Then I throw some exceptions in code, like
Raven catches and log exceptions only in my main Vue instance methods.
Any other errors in components, modules, etc. cause this error in console
For example:
This works. Test error is logged in Sentry.
Same throw in any other components methods cause error.
What is the expected behavior?
Log any uncaught exceptions in code, don't cause errors.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: