Skip to content
Snippets Groups Projects

fix: display untreated validation errors in error handler

Merged Florent Poittevin requested to merge fpo/display_untreated_validation_errors into master
2 unresolved threads

Merge request reports

Approval is optional

Merged by Florent PoittevinFlorent Poittevin 1 year ago (Mar 6, 2024 2:16pm UTC)

Merge details

  • Changes merged into master with 05e3ac1f (commits were squashed).
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
122 const isErrorToTreat = ErrorHelper.isErrorToTreat(nativeError, httpErrorKeyToSkipInErrorHandler);
123 if (isErrorToTreat) {
121 const isBackendError = nativeError instanceof HttpErrorResponse;
122 if (isBackendError) {
123 const isErrorToDisplay = ErrorHelper.isErrorToDisplay(nativeError, httpErrorKeyToSkipInErrorHandler);
124 if (isErrorToDisplay) {
124 125 // Server Error
125 126 message = this.errorService.getServerMessage(nativeError);
126 const subMessage = nativeError.error?.message;
127 subMessage = this.errorService.getServerSubMessage(nativeError);
127 128 stackTrace = this.errorService.getServerStack(nativeError);
128 129 if (isNotNullNorUndefined(notifierService)) {
129 130 notifierService.showError(message, undefined, undefined, subMessage, undefined, nativeError);
130 131 }
132 } else {
133 // DISPLAY NOTHING TO USER
  • 91 100 return error.message;
    92 101 }
    93 102
    103 getServerSubMessage(error: HttpErrorResponse): string {
    104 if (error.status === HttpStatusCode.BadRequest) {
    105 const listValidationErrors = ErrorHelper.extractValidationErrorsNotAlreadyDisplayedFromError(error);
    106 const validationErrorsMessage = ErrorHelper.mergeValidationErrorsMessages(listValidationErrors);
  • Florent Poittevin added 2 commits

    added 2 commits

    • 6b76474a - fix: display untreated validation errors in error handler
    • 512a8656 - chore: fix MR

    Compare with previous version

  • Please register or sign in to reply
    Loading