Skip to content

Commit b6de516

Browse files
SCAL-256912 updated ErrorDetailsTypes enum
1 parent 4b19aec commit b6de516

File tree

5 files changed

+224
-152
lines changed

5 files changed

+224
-152
lines changed

src/embed/conversation.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,13 @@ export class SpotterEmbed extends TsEmbed {
229229
} = this.viewConfig;
230230

231231
if (!worksheetId) {
232-
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND, code: ERROR_CODE.WORKSHEET_ID_NOT_FOUND, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
232+
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND, {
233+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
234+
message: ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
235+
code: ERROR_CODE.WORKSHEET_ID_NOT_FOUND,
236+
source: ErrorDetailsSources.SDK,
237+
details: {},
238+
} as EmbedErrorDetailsEvent);
233239
}
234240
const queryParams = this.getBaseQueryParams();
235241
queryParams[Param.SpotterEnabled] = true;

src/embed/liveboard.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,13 @@ export class LiveboardEmbed extends V1Embed {
622622
const liveboardId = this.viewConfig.liveboardId ?? this.viewConfig.pinboardId;
623623

624624
if (!liveboardId) {
625-
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION, code: ERROR_CODE.LIVEBOARD_ID_MISSING, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
625+
this.handleError(ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION, {
626+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
627+
message: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
628+
code: ERROR_CODE.LIVEBOARD_ID_MISSING,
629+
source: ErrorDetailsSources.SDK,
630+
details: {},
631+
} as EmbedErrorDetailsEvent);
626632
}
627633
return `${this.getRootIframeSrc()}${this.getIframeSuffixSrc(
628634
liveboardId,

src/embed/ts-embed.ts

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ export class TsEmbed {
221221
* Throws error encountered during initialization.
222222
*/
223223
private throwInitError() {
224-
this.handleError(ERROR_MESSAGE.INIT_SDK_REQUIRED, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.INIT_SDK_REQUIRED, code: ERROR_CODE.INIT_ERROR, source: ErrorDetailsSources.SDK, details: {}, } as EmbedErrorDetailsEvent);
224+
this.handleError(ERROR_MESSAGE.INIT_SDK_REQUIRED, {
225+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
226+
message: ERROR_MESSAGE.INIT_SDK_REQUIRED,
227+
code: ERROR_CODE.INIT_ERROR,
228+
source: ErrorDetailsSources.SDK,
229+
details: {},
230+
} as EmbedErrorDetailsEvent);
225231
}
226232

227233
/**
@@ -334,7 +340,13 @@ export class TsEmbed {
334340
this.executeCallbacks(EmbedEvent.Error, {
335341
offlineWarning,
336342
});
337-
const errorDetails = { errorType: ErrorDetailsTypes.NETWORK, message: ERROR_MESSAGE.OFFLINE_WARNING, code: ERROR_CODE.NETWORK_ERROR, source: ErrorDetailsSources.NETWORK, details: { event: e, } } as EmbedErrorDetailsEvent;
343+
const errorDetails = {
344+
errorType: ErrorDetailsTypes.NETWORK,
345+
message: ERROR_MESSAGE.OFFLINE_WARNING,
346+
code: ERROR_CODE.NETWORK_ERROR,
347+
source: ErrorDetailsSources.NETWORK,
348+
details: { event: e },
349+
} as EmbedErrorDetailsEvent;
338350
this.executeCallbacks(EmbedEvent.ErrorDetails, errorDetails);
339351
logger.warn(errorDetails);
340352
};
@@ -450,7 +462,16 @@ export class TsEmbed {
450462
...(this.embedConfig.customActions || [])
451463
]);
452464
if (customActionsResult.errors.length > 0) {
453-
this.handleError({ type: ERROR_CODE.CUSTOM_ACTION_VALIDATION, message: customActionsResult.errors }, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: customActionsResult.errors, code: ERROR_CODE.CUSTOM_ACTION_VALIDATION, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
465+
this.handleError(
466+
{ type: ERROR_CODE.CUSTOM_ACTION_VALIDATION, message: customActionsResult.errors },
467+
{
468+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
469+
message: customActionsResult.errors,
470+
code: ERROR_CODE.CUSTOM_ACTION_VALIDATION,
471+
source: ErrorDetailsSources.SDK,
472+
details: {},
473+
} as EmbedErrorDetailsEvent,
474+
);
454475
}
455476
const baseInitData = {
456477
customisations: getCustomisations(this.embedConfig, this.viewConfig),
@@ -662,12 +683,24 @@ export class TsEmbed {
662683
};
663684

664685
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
665-
this.handleError(ERROR_MESSAGE.CONFLICTING_ACTIONS_CONFIG, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.CONFLICTING_ACTIONS_CONFIG, code: ERROR_CODE.CONFLICTING_ACTIONS_CONFIG, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
686+
this.handleError(ERROR_MESSAGE.CONFLICTING_ACTIONS_CONFIG, {
687+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
688+
message: ERROR_MESSAGE.CONFLICTING_ACTIONS_CONFIG,
689+
code: ERROR_CODE.CONFLICTING_ACTIONS_CONFIG,
690+
source: ErrorDetailsSources.SDK,
691+
details: {},
692+
} as EmbedErrorDetailsEvent);
666693
return queryParams;
667694
}
668695

669696
if (Array.isArray(visibleTabs) && Array.isArray(hiddenTabs)) {
670-
this.handleError(ERROR_MESSAGE.CONFLICTING_TABS_CONFIG, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.CONFLICTING_TABS_CONFIG, code: ERROR_CODE.CONFLICTING_TABS_CONFIG, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
697+
this.handleError(ERROR_MESSAGE.CONFLICTING_TABS_CONFIG, {
698+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
699+
message: ERROR_MESSAGE.CONFLICTING_TABS_CONFIG,
700+
code: ERROR_CODE.CONFLICTING_TABS_CONFIG,
701+
source: ErrorDetailsSources.SDK,
702+
details: {},
703+
} as EmbedErrorDetailsEvent);
671704
return queryParams;
672705
}
673706
if (primaryAction) {
@@ -920,7 +953,13 @@ export class TsEmbed {
920953
error: JSON.stringify(error),
921954
});
922955
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
923-
this.handleError(ERROR_MESSAGE.LOGIN_FAILED, { errorType: ErrorDetailsTypes.API, message: error.message || ERROR_MESSAGE.LOGIN_FAILED, code: ERROR_CODE.LOGIN_FAILED, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
956+
this.handleError(ERROR_MESSAGE.LOGIN_FAILED, {
957+
errorType: ErrorDetailsTypes.API,
958+
message: error.message || ERROR_MESSAGE.LOGIN_FAILED,
959+
code: ERROR_CODE.LOGIN_FAILED,
960+
source: ErrorDetailsSources.SDK,
961+
details: {},
962+
} as EmbedErrorDetailsEvent);
924963
});
925964
});
926965
}
@@ -1327,12 +1366,24 @@ export class TsEmbed {
13271366
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
13281367

13291368
if (!this.isRendered) {
1330-
this.handleError(ERROR_MESSAGE.RENDER_BEFORE_EVENTS_REQUIRED, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.RENDER_BEFORE_EVENTS_REQUIRED, code: ERROR_CODE.RENDER_NOT_CALLED, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
1369+
this.handleError(ERROR_MESSAGE.RENDER_BEFORE_EVENTS_REQUIRED, {
1370+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
1371+
message: ERROR_MESSAGE.RENDER_BEFORE_EVENTS_REQUIRED,
1372+
code: ERROR_CODE.RENDER_NOT_CALLED,
1373+
source: ErrorDetailsSources.SDK,
1374+
details: {},
1375+
} as EmbedErrorDetailsEvent);
13311376
return null;
13321377
}
13331378

13341379
if (!messageType) {
1335-
this.handleError(ERROR_MESSAGE.HOST_EVENT_TYPE_UNDEFINED, { errorType: ErrorDetailsTypes.VALIDATION_ERROR, message: ERROR_MESSAGE.HOST_EVENT_TYPE_UNDEFINED, code: ERROR_CODE.HOST_EVENT_TYPE_UNDEFINED, source: ErrorDetailsSources.SDK, details: {} } as EmbedErrorDetailsEvent);
1380+
this.handleError(ERROR_MESSAGE.HOST_EVENT_TYPE_UNDEFINED, {
1381+
errorType: ErrorDetailsTypes.VALIDATION_ERROR,
1382+
message: ERROR_MESSAGE.HOST_EVENT_TYPE_UNDEFINED,
1383+
code: ERROR_CODE.HOST_EVENT_TYPE_UNDEFINED,
1384+
source: ErrorDetailsSources.SDK,
1385+
details: {},
1386+
} as EmbedErrorDetailsEvent);
13361387
return null;
13371388
}
13381389

src/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,6 +6135,15 @@ export enum ErrorDetailsTypes {
61356135
INVALID_OPERATOR = 'INVALID_OPERATOR',
61366136
VALIDATION_ERROR = 'VALIDATION_ERROR',
61376137
NETWORK = 'NETWORK',
6138+
WRONG_VIZ_ID = 'WRONG_VIZ_ID',
6139+
NOT_A_WORKSHEET = 'NOT_A_WORKSHEET',
6140+
NO_FILTERABLE_COLUMN_PRESENT = 'NO_FILTERABLE_COLUMN_PRESENT',
6141+
FILTER_EXISTS_OR_NO_ATTRIBUTE_COLUMN = 'FILTER_EXISTS_OR_NO_ATTRIBUTE_COLUMN',
6142+
INVALID_COLUMN_ID = 'INVALID_COLUMN_ID',
6143+
CONV_ASSIST_ERROR = 'CONV_ASSIST_ERROR',
6144+
GENERIC_ERROR = 'GENERIC_ERROR',
6145+
TIMEOUT_ERROR = 'TIMEOUT_ERROR',
6146+
CONVEX_ERROR = 'CONVEX_ERROR',
61386147
}
61396148

61406149
/**

0 commit comments

Comments
 (0)