Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
) {
const {
meta: { error },
} = action;
// Check that the `error` is set
if (!error && process.env.NODE_ENV !== 'production')
// eslint-disable-next-line no-console
console.error('Missing error object when dispatching unexpected error.');
if (process.env.NODE_ENV !== 'production') return next(action);
// Send the error to Sentry
Raven.captureException(error);
// Generate a unique ID referring to the last generated Sentry error
const errorId = Raven.lastEventId();
// The error stack should be available in Sentry, so there is no
// need to print it in the console as well.
// We just notify that an error occured and provide the error ID.
// eslint-disable-next-line no-console
console.error(`An error occured (ID: ${errorId}).`);
// Inject the generated errorId into the notification values,
// in order to display it in the notification message.
return next({
...action,
payload: {
...action.payload,
values: {
...action.payload.values,
errorId,
openDialog = () => {
Raven.lastEventId() && Raven.showReportDialog({});
};
<div> Raven.lastEventId() && Raven.showReportDialog()}>
<p>We’re sorry — something’s gone wrong.</p></div>
return React.Children.map(children, child =>
React.cloneElement(child, { ...rest })
);
}
if (hidden) {
return null;
}
return (
<div>
<div> !openReportDialog && this.openDialog()}>
<div>
<h3>En feil har oppstått</h3>
<p>
Webansvarling har fått beskjed om feilen.{' '}
{!openReportDialog && Raven.lastEventId() && (
<span>
Klikk <b>her</b> for å sende en rapport.
</span>
)}
</p>
</div>
</div>
</div>
);
}
}
handleError(err: any): void {
if (!err.data) {
err.name = `[MyErrorHandler] ${err.message}`;
err.message = `[MyErrorHandler] ${err.message}: -`;
err.data = {
name: err.name,
message: '-'
};
}
if (environment.canUseRaven === true) {
Raven.captureException(err);
err.data.event_id = Raven.lastEventId();
}
let openDialogs = this.dialog.openDialogs;
if (openDialogs.length < 5) {
this.ngZone.run(() => {
this.myDialogService.showErDialog({ error: err });
});
}
super.handleError(err);
}
}
return super.report(userFeedback, feedbackCategory, userEmail).then(() => {
return cordova.plugins.outline.log.send(Raven.lastEventId());
});
}
reportError = event => {
event.preventDefault();
if (Raven.lastEventId()) {
Raven.showReportDialog();
}
}
onClick={() => Raven.lastEventId() && Raven.showReportDialog()}
variant="contained"
render() {
const {
isMenuOpen,
searchTerm,
selectedVenue,
loading,
error,
isAvailabilityEnabled,
searchOptions,
} = this.state;
if (error) {
return ;
}
if (loading) {
return (
<div>
{pageHead}
</div>
);
}
let venues = searchVenue(this.state.venues, searchTerm);
const unfilteredCount = size(venues);
if (isAvailabilityEnabled) {
venues = filterAvailability(venues, searchOptions);
render() {
const { ModulePageContent, error } = this.state;
const { module, moduleCode, match } = this.props;
if (!this.doesModuleExist(moduleCode)) {
return ;
}
if (error) {
return ;
}
if (module && match.url !== this.canonicalUrl()) {
return ;
}
if (module && ModulePageContent) {
return ;
}
return ;
}
}