Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Jul 13, 2020
1 parent bd6fec3 commit dd6fc5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/public/notifications/toasts/error_toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface RequestError extends Error {
body?: { attributes?: { error: { caused_by: { type: string; reason: string } } } };
}

const isRequestError = (e: Error): e is RequestError =>
const isRequestError = (e: any): e is RequestError =>
e.body?.attributes?.error?.caused_by !== undefined;

/**
Expand All @@ -65,8 +65,8 @@ function showErrorDialog({
let text = '';

if (isRequestError(error)) {
text += `${error.body.attributes.error.caused_by.type}\n`;
text += `${error.body.attributes.error.caused_by.reason}\n\n`;
text += `${error?.body?.attributes?.error?.caused_by.type}\n`;
text += `${error?.body?.attributes?.error?.caused_by.reason}\n\n`;
}

if (error.stack) {
Expand Down

0 comments on commit dd6fc5d

Please sign in to comment.