Skip to content
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

fix: Change Vue interface to be inline with the original types #2634

Merged
merged 3 commits into from Jun 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 5 additions & 8 deletions packages/integrations/src/vue.ts
Expand Up @@ -11,11 +11,11 @@ const TRACING_GETTER = ({

/** Global Vue object limited to the methods/attributes we require */
interface VueInstance {
config?: {
config: {
errorHandler?(error: Error, vm?: ViewModel, info?: string): void; // tslint:disable-line:completed-docs
};
mixin(hooks: { [key: string]: () => void }): void; // tslint:disable-line:completed-docs
util: {
util?: {
warn(...input: any): void; // tslint:disable-line:completed-docs
};
}
Expand Down Expand Up @@ -338,11 +338,6 @@ export class Vue implements Integration {

/** Inject Sentry's handler into owns Vue's error handler */
private _attachErrorHandler(getCurrentHub: () => Hub): void {
if (!this._options.Vue.config) {
logger.error('Vue instance is missing required `config` attribute');
return;
}

const currentErrorHandler = this._options.Vue.config.errorHandler; // tslint:disable-line:no-unbound-method

this._options.Vue.config.errorHandler = (error: Error, vm?: ViewModel, info?: string): void => {
Expand Down Expand Up @@ -379,7 +374,9 @@ export class Vue implements Integration {
}

if (this._options.logErrors) {
this._options.Vue.util.warn(`Error in ${info}: "${error.toString()}"`, vm);
if (this._options.Vue.util) {
this._options.Vue.util.warn(`Error in ${info}: "${error.toString()}"`, vm);
}
console.error(error); // tslint:disable-line:no-console
}
};
Expand Down