Skip to content

Commit

Permalink
fix: log error trace in catch blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpagtakhan committed Oct 25, 2023
1 parent 1a2d6a4 commit bf36fe0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/analytics-core/src/core-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export class AmplitudeCore implements CoreClient {

return result;
} catch (e) {
this.config.loggerProvider.error(e);
const message = String(e);
this.config.loggerProvider.error(message);
const result = buildResult(event, 0, message);

return result;
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-core/src/plugins/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ export class Destination implements DestinationPlugin {
}
this.handleResponse(res, list);
} catch (e) {
this.config.loggerProvider.error(e);
const errorMessage = getErrorMessage(e);
this.config.loggerProvider.error(errorMessage);
this.fulfillRequest(list, 0, errorMessage);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export const gaEventsForwarderPlugin = ({ measurementIds = [] }: Options = {}):
}
}
return true;
} catch (error) {
} catch (e) {
/* istanbul ignore next */
logger?.error(String(error));
logger?.error(e);
return false;
}
};
Expand Down

0 comments on commit bf36fe0

Please sign in to comment.