Skip to content

Commit

Permalink
[#noissue] change json error res format
Browse files Browse the repository at this point in the history
  • Loading branch information
binDongKim authored and ga-ram committed Jul 12, 2022
1 parent c756bd1 commit 375c3a2
Show file tree
Hide file tree
Showing 69 changed files with 329 additions and 403 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class AgentEventViewContainerComponent implements OnInit, OnDestroy {
this.messageQueueService.receiveMessage(this.unsubscribe, MESSAGE_TO.TIMELINE_SELECTED_EVENT_STATUS).pipe(
switchMap((eventSegment: ITimelineEventSegment) => {
return this.agentEventsDataService.getData(eventSegment.startTimestamp, eventSegment.endTimestamp).pipe(
catchError((error: IServerErrorFormat) => {
catchError((error: IServerError) => {
this.dynamicPopupService.openPopup({
data: {
title: 'Error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class AgentInfoContainerComponent implements OnInit, OnDestroy {
this.agentData = agentData;
this.dataRequestSuccess = true;
this.completed();
}, (_: IServerErrorFormat) => {
}, (_: IServerError) => {
this.dataRequestSuccess = false;
this.completed();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,18 @@ export class AlarmRuleListContainerComponent implements OnInit, OnDestroy {
}

private loadCheckerList(): void {
this.alarmRuleDataService.getCheckerList().subscribe((result: string[] | IServerErrorShortFormat) => {
isThatType<IServerErrorShortFormat>(result, 'errorCode', 'errorMessage')
? this.errorMessage = result.errorMessage
: this.checkerList = result as string[];
}, (error: IServerErrorFormat) => {
this.errorMessage = error.exception.message;
this.alarmRuleDataService.getCheckerList().subscribe((result: string[]) => {
this.checkerList = result as string[];
}, (error: IServerError) => {
this.errorMessage = error.message;
});
}

private loadUserGroupList(): void {
this.userGroupDataSerivce.retrieve().subscribe((result: IUserGroup[] | IServerErrorShortFormat) => {
isThatType<IServerErrorShortFormat>(result, 'errorCode', 'errorMessage')
? this.errorMessage = result.errorMessage
: this.userGroupList = result.map((userGroup: IUserGroup) => userGroup.id);
}, (error: IServerErrorFormat) => {
this.errorMessage = error.exception.message;
this.userGroupDataSerivce.retrieve().subscribe((result: IUserGroup[]) => {
this.userGroupList = result.map((userGroup: IUserGroup) => userGroup.id);
}, (error: IServerError) => {
this.errorMessage = error.message;
});
}

Expand Down Expand Up @@ -145,14 +141,12 @@ export class AlarmRuleListContainerComponent implements OnInit, OnDestroy {

private getAlarmData(): void {
this.showProcessing();
this.alarmRuleDataService.retrieve(this.selectedApplication.getApplicationName()).subscribe((result: IAlarmRule[] | IServerErrorShortFormat) => {
isThatType<IServerErrorShortFormat>(result, 'errorCode', 'errorMessage')
? this.errorMessage = result.errorMessage
: this.alarmRuleList = result;
this.alarmRuleDataService.retrieve(this.selectedApplication.getApplicationName()).subscribe((result: IAlarmRule[]) => {
this.alarmRuleList = result;
this.hideProcessing();
}, (error: IServerErrorFormat) => {
}, (error: IServerError) => {
this.hideProcessing();
this.errorMessage = error.exception.message;
this.errorMessage = error.message;
});
}

Expand All @@ -169,32 +163,22 @@ export class AlarmRuleListContainerComponent implements OnInit, OnDestroy {
forkJoin(
this.webhookDataService.getWebhookListByAppId(this.selectedApplication.applicationName),
this.webhookDataService.getWebhookListByAlarmId(this.editAlarm.ruleId),
).subscribe(([webhookList, checkedWebhookList]: IWebhook[][] | IServerErrorShortFormat[]) => {
if (isThatType<IServerErrorShortFormat>(webhookList, 'errorCode', 'errorMessage')) {
this.errorMessage = webhookList.errorMessage;
} else if (isThatType<IServerErrorShortFormat>(checkedWebhookList, 'errorCode', 'errorMessage')) {
this.errorMessage = checkedWebhookList.errorMessage;
} else {
this.webhookList = webhookList;
this.checkedWebhookList = checkedWebhookList.map(({webhookId}) => webhookId);
}
).subscribe(([webhookList, checkedWebhookList]: IWebhook[][]) => {
this.webhookList = webhookList;
this.checkedWebhookList = checkedWebhookList.map(({webhookId}) => webhookId);

blockWebhook(false);
}, (error: IServerErrorFormat) => {
this.errorMessage = error.exception.message;
}, (error: IServerError) => {
this.errorMessage = error.message;
blockWebhook(false);
});
} else {
this.webhookDataService.getWebhookListByAppId(this.selectedApplication.applicationName).subscribe((result: IWebhook[] | IServerErrorShortFormat) => {
if (isThatType<IServerErrorShortFormat>(result, 'errorCode', 'errorMessage')) {
this.errorMessage = result.errorMessage;
} else {
this.webhookList = result;
}
this.webhookDataService.getWebhookListByAppId(this.selectedApplication.applicationName).subscribe((result: IWebhook[]) => {
this.webhookList = result;

blockWebhook(false);
}, (error: IServerErrorFormat) => {
this.errorMessage = error.exception.message;
}, (error: IServerError) => {
this.errorMessage = error.message;
blockWebhook(false);
});
}
Expand All @@ -221,17 +205,12 @@ export class AlarmRuleListContainerComponent implements OnInit, OnDestroy {
? this.alarmRuleDataService.createWithWebhook(param as IAlarmWithWebhook)
: this.alarmRuleDataService.create(param);

postAlarmRule.subscribe((response: IAlarmRuleCreated | IServerErrorShortFormat) => {
if (isThatType<IServerErrorShortFormat>(response, 'errorCode', 'errorMessage')) {
this.errorMessage = response.errorMessage;
this.hideProcessing();
} else {
this.getAlarmData();
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.CREATE_ALARM);
}
}, (error: IServerErrorFormat) => {
postAlarmRule.subscribe((response: IAlarmRuleCreated) => {
this.getAlarmData();
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.CREATE_ALARM);
}, (error: IServerError) => {
this.hideProcessing();
this.errorMessage = error.exception.message;
this.errorMessage = error.message;
});
}

Expand Down Expand Up @@ -259,17 +238,12 @@ export class AlarmRuleListContainerComponent implements OnInit, OnDestroy {
? this.alarmRuleDataService.updateWithWebhook(param as IAlarmWithWebhook)
: this.alarmRuleDataService.update(param as IAlarmRule);

putAlarmRule.subscribe((response: IAlarmRuleResponse | IServerErrorShortFormat) => {
if (isThatType<IServerErrorShortFormat>(response, 'errorCode', 'errorMessage')) {
this.errorMessage = (response as IServerErrorShortFormat).errorMessage;
this.hideProcessing();
} else {
this.getAlarmData();
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.UPDATE_ALARM);
}
}, (error: IServerErrorFormat) => {
putAlarmRule.subscribe((response: IAlarmRuleResponse) => {
this.getAlarmData();
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.UPDATE_ALARM);
}, (error: IServerError) => {
this.hideProcessing();
this.errorMessage = error.exception.message;
this.errorMessage = error.message;
});
}

Expand Down Expand Up @@ -300,17 +274,12 @@ export class AlarmRuleListContainerComponent implements OnInit, OnDestroy {
applicationId: this.selectedApplication.getApplicationName(),
};

this.alarmRuleDataService.remove(params).subscribe((response: IAlarmRuleResponse | IServerErrorShortFormat) => {
if (isThatType<IServerErrorShortFormat>(response, 'errorCode', 'errorMessage')) {
this.errorMessage = (response as IServerErrorShortFormat).errorMessage;
this.hideProcessing();
} else {
this.getAlarmData();
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.REMOVE_ALARM);
}
}, (error: IServerErrorFormat) => {
this.alarmRuleDataService.remove(params).subscribe((response: IAlarmRuleResponse) => {
this.getAlarmData();
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.REMOVE_ALARM);
}, (error: IServerError) => {
this.hideProcessing();
this.errorMessage = error.exception.message;
this.errorMessage = error.message;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class ApplicationListForAgentManagementContainerComponent implements OnIn

this.storeHelperService.getApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class ApplicationListForConfigurationAlarmContainerComponent implements O

this.storeHelperService.getApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ApplicationListForConfigurationContainerComponent implements OnInit

this.storeHelperService.getApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand All @@ -114,7 +114,7 @@ export class ApplicationListForConfigurationContainerComponent implements OnInit

this.storeHelperService.getFavoriteApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand All @@ -133,7 +133,7 @@ export class ApplicationListForConfigurationContainerComponent implements OnInit

this.storeHelperService.getFavoriteApplicationAddError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ApplicationListForConfigurationWebhookContainerComponent implements

this.storeHelperService.getApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class ApplicationListForHeaderContainerComponent implements OnInit, After

this.storeHelperService.getApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand All @@ -144,7 +144,7 @@ export class ApplicationListForHeaderContainerComponent implements OnInit, After

this.storeHelperService.getFavoriteApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ export class FavoriteApplicationListForConfigurationContainerComponent implement

this.storeHelperService.getApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
});

this.storeHelperService.getFavoriteApplicationListError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
});

this.storeHelperService.getFavoriteApplicationRemoveError().pipe(
takeUntil(this.unsubscribe)
).subscribe((error: IServerErrorFormat) => {
).subscribe((error: IServerError) => {
this.hideProcessing();
this.dynamicPopupService.openPopup({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ConfigurationAgentStatisticContainerComponent implements OnInit, On
this.agentStatisticDataService.getData().subscribe((agentList: IAgentList) => {
this.storeHelperService.dispatch(new Actions.UpdateAdminAgentList(agentList));
this.hideProcessing();
}, (error: IServerErrorFormat) => {
}, (error: IServerError) => {
this.dynamicPopupService.openPopup({
data: {
title: 'Error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ConfigurationInspectorChartManagerContainerComponent implements OnI
takeUntil(this.unsubscribe)
).subscribe((applicationData: {[key: string]: IChartLayoutInfo[]}) => {
this.storeHelperService.dispatch(new Actions.UpdateApplicationInspectorChartLayout(applicationData));
}, (error: IServerErrorFormat) => {
}, (error: IServerError) => {
this.storeHelperService.dispatch(new Actions.UpdateApplicationInspectorChartLayout({
applicationInspectorChart: []
}));
Expand All @@ -31,7 +31,7 @@ export class ConfigurationInspectorChartManagerContainerComponent implements OnI
takeUntil(this.unsubscribe)
).subscribe((agentData: {[key: string]: IChartLayoutInfo[]}) => {
this.storeHelperService.dispatch(new Actions.UpdateAgentInspectorChartLayout(agentData));
}, (error: IServerErrorFormat) => {
}, (error: IServerError) => {
this.storeHelperService.dispatch(new Actions.UpdateAgentInspectorChartLayout({
applicationInspectorChart: []
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ConfigurationInstallationContainerComponent implements OnInit {
return data.code === 0;
}),
pluck('message'),
catchError((error: IServerErrorFormat) => {
catchError((error: IServerError) => {
this.dynamicPopupService.openPopup({
data: {
title: 'Error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export class AgentIdDuplicationCheckContainerComponent implements OnInit {
pluck('value')
).subscribe((value: string) => {
this.onCheckSuccess(value, '');
}, (error: IServerErrorFormat) => {
this.onCheckFail(error.exception.message);
}, (error: IServerError) => {
this.onCheckFail(error.message);
});
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.CHECK_AGENT_NAME_DUPLICATION);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export class ApplicationNameDuplicationCheckContainerComponent implements OnInit
pluck('value')
).subscribe((value: string) => {
this.onCheckSuccess(value, '');
}, (error: IServerErrorFormat) => {
this.onCheckFail(error.exception.message);
}, (error: IServerError) => {
this.onCheckFail(error.message);
});
this.analyticsService.trackEvent(TRACKED_EVENT_LIST.CHECK_APPLICATION_NAME_DUPLICATION);
}
Expand Down
Loading

0 comments on commit 375c3a2

Please sign in to comment.