Skip to content

Commit

Permalink
chore: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MoumitaM committed Jul 31, 2024
1 parent 910806c commit 959c5d9
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@ const normaliseError = (maybeError: any, component: string, logger?: ILogger) =>
let error;
let internalFrames = 0;

if (typeof maybeError === 'object' && isError(maybeError)) {
if (isError(maybeError)) {
error = maybeError;
} else if (typeof maybeError === 'object' && hasNecessaryFields(maybeError)) {
error = new Error(maybeError.message || maybeError.errorMessage);
error.name = maybeError.name || maybeError.errorClass;
internalFrames += 1;
} else {
if (logger)
logger.warn(
`${ERROR_REPORTING_PLUGIN}:: ${component} received a non-error: ${stringifyWithoutCircular(error)}`,
);
logger?.warn(
`${ERROR_REPORTING_PLUGIN}:: ${component} received a non-error: ${stringifyWithoutCircular(error)}`,
);
error = undefined;
}

Expand Down

0 comments on commit 959c5d9

Please sign in to comment.