ktmud commented on code in PR #19942:
URL: https://github.com/apache/superset/pull/19942#discussion_r866046264
##########
superset-frontend/src/utils/getClientErrorObject.ts:
##########
@@ -48,7 +48,13 @@ export function parseErrorJson(responseObject: JsonObject):
ClientErrorObject {
error.error = error.description = error.errors[0].message;
error.link = error.errors[0]?.extra?.link;
}
-
+ // Marshmallow field validation returns the error mssage in the format
+ // of { message: { field1: [msg1, msg2], field2: [msg], } }
+ if (typeof error.message === 'object' && !error.error) {
+ error.error =
+ Object.values(error.message as Record<string, string[]>)[0]?.[0] ||
Review Comment:
`Object.values()` should always return an array as long as the input object
exists. I can add another check in L53 to make sure `error.message` is not
`null`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]