Skip to content

Commit

Permalink
fix: Change Vue interface to be inline with the original types (#2634)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Griesser <daniel.griesser.86@gmail.com>
  • Loading branch information
kamilogorek and HazAT committed Jun 5, 2020
1 parent 1fb0580 commit fc53353
Showing 1 changed file with 5 additions and 8 deletions.
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

0 comments on commit fc53353

Please sign in to comment.