Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
eventId: "eventId",
ddsn: "dsn",
user: {
name: "name",
email: "email"
}
});
// $ExpectError - eventId must be a string
Raven.showReportDialog({ eventId: 1 });
// $ExpectError - dsn must be a string
Raven.showReportDialog({ dsn: 1 });
// $ExpectError - user name must be a string
Raven.showReportDialog({
user: { name: { first: "first", last: "last" } }
});
});
});
public handleError(error: any): void {
if (error.name === 'HttpErrorResponse') {
return;
}
if (runtimeEnvironment.environment !== Environment.development) {
// App is in Production
if (runtimeEnvironment.ravenURL) {
// Raven enabled
console.error(error);
Raven.captureException(error);
if (JSON.parse(localStorage.getItem('appstate') || '').sendFeedback || false) {
Raven.showReportDialog();
}
} else {
// Nothing, maybe later an error Dialog
console.error(error);
}
} else {
// App is in Development
throw error;
}
}
}
handleError(error: any): void {
if (environment.production) {
// In IE, originalError is not always set apparently
if (error.originalError) {
Raven.captureException(error.originalError);
} else {
Raven.captureException(error);
}
Raven.showReportDialog({});
} else {
console.error(error);
}
}
}
RavenJS.context({tags: { key: "value" }}, throwsError);
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);
setTimeout(RavenJS.wrap(throwsError), 1000);
RavenJS.wrap({logger: "my.module"}, throwsError)();
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();
RavenJS.setUserContext({
email: 'matt@example.com',
id: '123'
});
RavenJS.captureMessage('Broken!');
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});
RavenJS.showReportDialog({
eventId: 0815,
dsn:'1337asdf',
user: {
name: 'DefenitelyTyped',
email: 'df@ts.ms'
}
});
RavenJS.setTagsContext({ key: "value" });
RavenJS.setExtraContext({ foo: "bar" });
public handleError(error: any, url: string, dispatch: any) {
Raven.captureException(error)
Raven.showReportDialog({})
dispatch(
sendSnackbarMessage({
message: `Error from ${url}`,
action: "Dismiss",
autoHideDuration: 4000,
onActionClick: () => {
dispatch(iterateSnackbar())
},
})
)
}
<button> Raven.showReportDialog({ eventId })}>
tell us more about what happened</button>
<button> Raven.showReportDialog({ eventId })}>
do tell us</button>