Differentiate rule violation errors from server errors in UI#26117
Differentiate rule violation errors from server errors in UI#26117
Conversation
Rule violations (400) and server errors (500) were showing the same red error banner, making it impossible for users to distinguish between "I need to fix something" and "the system is broken". Backend: Handle RuleValidationException specifically in the exception mapper, returning a response with errorType: "RULE_VIOLATION" using the existing SDK ErrorMessage format (which includes code, errorType, and message fields). Frontend: Detect the RULE_VIOLATION errorType in showErrorToast and display rule violations as warning toasts (orange) instead of error toasts (red). Warnings auto-close after 5s while errors persist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| } | ||
| callback && callback(errorMessage); | ||
|
|
||
| const alertType = isRuleViolation ? 'warning' : 'error'; |
There was a problem hiding this comment.
💡 Quality: alertType inferred as string instead of AlertBarProps['type']
The ternary const alertType = isRuleViolation ? 'warning' : 'error' is inferred as string by TypeScript. The addAlert method expects AlertProps['type'] (which is 'success' | 'info' | 'warning' | 'error' | undefined). While this works at runtime, it bypasses type checking — if someone later changes one of the string literals to a typo, the compiler won't catch it.
Adding a type annotation makes the intent explicit and enables compile-time safety:
const alertType: AlertBarProps['type'] = isRuleViolation ? 'warning' : 'error';This is a minor improvement — TypeScript will likely narrow the type correctly from the string literals in practice.
Suggested fix:
const alertType: AlertBarProps['type'] = isRuleViolation ? 'warning' : 'error';
Was this helpful? React with 👍 / 👎
🔍 CI failure analysis for 1bee612: Maven SonarCloud CI failed with 50 test failures unrelated to PR changes - issues from main branch merge including API service deserialization problems, S3/storage failures, and JSON serialization changes.Issue: Maven SonarCloud CI - 50 Test FailuresThe maven-sonarcloud-ci job failed with 50 test failures out of 7,978 tests. These failures appear to be from the main branch merge (commit 1bee612), not from this PR's changes. Failure Categories1. API Service Connection Deserialization (~40+ failures)
2. Ingestion Pipeline Log Storage (~4 failures)
3. JSON Serialization Change (1 failure)
4. OpenSearch Container Startup (1 failure)
5. S3 Storage Key Issues (1+ failure)
Relevance to This PRUNRELATED - This PR only modifies:
None of the 50 failing tests interact with exception handling or toast display logic. Recent Main Branch Changes (commit 1bee612 merge)
AssessmentThese are pre-existing test failures from main branch, not regressions from this PR. The Test Report job failure is cascading. RecommendationCheck if main branch has these same failures. Consider waiting for main branch fixes before merging. Code Review ✅ Approved 1 resolved / 1 findingsClean, well-structured PR that correctly differentiates rule violations from server errors. The exception handling order is correct (RuleValidationException before IllegalArgumentException), the frontend detection logic gracefully falls back to error toasts, and the auto-close behavior is properly handled by the alert store's built-in defaults. ✅ 1 resolved✅ Quality:
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|
|
Rule violations (400) and server errors (500) were showing the same red error banner, making it impossible for users to distinguish between "I need to fix something" and "the system is broken". Backend: Handle RuleValidationException specifically in the exception mapper, returning a response with errorType: "RULE_VIOLATION" using the existing SDK ErrorMessage format (which includes code, errorType, and message fields). Frontend: Detect the RULE_VIOLATION errorType in showErrorToast and display rule violations as warning toasts (orange) instead of error toasts (red). Warnings auto-close after 5s while errors persist. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>



Summary
RuleValidationException) and server errors (HTTP 500) were showing the same red error banner, making it impossible for users to distinguish between validation issues they need to fix and actual system failuresRuleValidationExceptionhandling inCatalogGenericExceptionMapperto return responses witherrorType: "RULE_VIOLATION"using the existing SDKErrorMessageformatshowErrorToastnow detects theRULE_VIOLATIONerror type and displays rule violations as warning toasts (orange/yellow) instead of error toasts (red), with auto-close after 5 secondsCloses https://github.com/open-metadata/openmetadata-collate/issues/2382
Test plan
RuleEngineTeststo verify existing assertions still pass with the updated response format