-
Notifications
You must be signed in to change notification settings - Fork 649
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
Added Validation block for validation errors #11152
base: develop
Are you sure you want to change the base?
Changes from 1 commit
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 |
---|---|---|
|
@@ -21,6 +21,28 @@ const formatKey = (key: string) => { | |
|
||
const notifyError = (error: any) => { | ||
let errorMsg = ""; | ||
|
||
if ( | ||
error?.type === "validation_error" && | ||
error?.msg && | ||
typeof error.msg === "object" | ||
) { | ||
Object.values(error.msg).forEach((messages) => { | ||
if (Array.isArray(messages)) { | ||
errorMsg += messages.join(", "); | ||
} else { | ||
errorMsg += messages; | ||
} | ||
}); | ||
|
||
if (errorMsg.length > 0) { | ||
toast.error(errorMsg); | ||
} else { | ||
toast.error("Something went wrong , please upload different image"); | ||
} | ||
return; | ||
} | ||
Comment on lines
+25
to
+44
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. 💡 Verification agent ❓ Verification inconclusiveTest coverage for the new validation block. The new validation error handling block handles a specific error format. Make sure to add tests for this scenario to ensure it works as expected for various validation error structures. Please verify that there are unit tests covering this new validation error handling logic, especially with:
🏁 Script executed: #!/bin/bash
# Search for test files that might test the notifyError function
fd -t f "test|spec" --exec grep -l "notifyError" {} \; Length of output: 57 Attention: Missing Unit Tests for New Validation Logic It appears that our automated search didn’t locate any test files referencing the validation error handling (e.g. via “notifyError” or “validation_error”) in our test or spec directories. Please manually verify if tests exist under alternate naming conventions. If not, add unit tests covering the following cases:
|
||
|
||
if (typeof error === "string" || !error) { | ||
errorMsg = | ||
!error || error.length > 100 ? "Something went wrong...!" : error; | ||
|
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.
Make sure to add translation.
Please follow the merge check list to avoid these mistakes.
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.
Sure