Skip to content

Commit

Permalink
Merge branch 'feat-add-diagnostics' of https://github.com/amplitude/A…
Browse files Browse the repository at this point in the history
…mplitude-TypeScript into feat-add-diagnostics
  • Loading branch information
Mercy811 committed Sep 27, 2023
2 parents 06ec693 + e17852a commit cdc2de2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/analytics-core/src/plugins/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class Destination implements DestinationPlugin {

async send(list: Context[], useRetry = true) {
if (!this.config.apiKey) {
(this.config.diagnosticProvider as Diagnostic).track(list.length, 400, 'missing API key');
return this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE);
}

Expand All @@ -154,6 +155,7 @@ export class Destination implements DestinationPlugin {
const { serverUrl } = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch);
const res = await this.config.transportProvider.send(serverUrl, payload);
if (res === null) {
(this.config.diagnosticProvider as Diagnostic).track(list.length, 0, 'unexpected error');
this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);
(this.config.diagnosticProvider as Diagnostic).track(list.length, 0, 'unexpected error');
return;
Expand Down

0 comments on commit cdc2de2

Please sign in to comment.