-
Notifications
You must be signed in to change notification settings - Fork 902
WEB-862: Handle API errors using userMessageGlobalisationCode with lo… #3411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,10 +240,19 @@ export class LoansViewComponent implements OnInit { | |
| }); | ||
| this.datatablesReady = true; | ||
| }, | ||
| error: () => { | ||
| // If API fails, keep all datatables (fallback to current behavior) | ||
| this.datatablesReady = true; | ||
| } | ||
| error: (err) => { | ||
| this.datatablesReady = true; | ||
|
|
||
| const errors = err.error?.errors; | ||
|
|
||
| if (errors && errors.length > 0) { | ||
| const message = errors | ||
| .map(e => this.translate.instant(e.userMessageGlobalisationCode)) | ||
| .join(' '); | ||
|
|
||
| alert(message); // or notification service if exists | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check for native alerts and existing app-level alert patterns to align this call.
rg -nP '\balert\s*\(' src/app --type=ts
rg -nP 'alertService\.alert|MatSnackBar|MatDialog' src/app/loans src/app/shared --type=tsRepository: openMF/web-app Length of output: 30334 Replace native Line 253 uses browser 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openMF/web-app
Length of output: 605
🏁 Script executed:
Repository: openMF/web-app
Length of output: 580
🏁 Script executed:
Repository: openMF/web-app
Length of output: 563
🏁 Script executed:
Repository: openMF/web-app
Length of output: 885
Fix undeclared translate service reference and add error message fallback with proper notification.
Line 250 uses
this.translate.instant(...), but the component declaresthis.translateService(Line 83). This reference will fail type-checking. Additionally, line 253 uses nativealert()instead of a notification service, and the error mapping lacks fallback fordefaultUserMessageordeveloperMessagewhenuserMessageGlobalisationCodeis missing.Proposed fix
🤖 Prompt for AI Agents