eschutho commented on code in PR #21034:
URL: https://github.com/apache/superset/pull/21034#discussion_r941913878


##########
superset-frontend/packages/superset-ui-core/src/connection/callApi/callApi.ts:
##########
@@ -146,10 +146,23 @@ export default async function callApi({
         Object.keys(payload).forEach(key => {
           const value = (payload as JsonObject)[key] as JsonValue;
           if (typeof value !== 'undefined') {
-            formData.append(
-              key,
-              stringify ? JSON.stringify(value) : String(value),
-            );
+            let val;
+            try {
+              // We have seen instances where casting to String() throws error
+              // This check allows all valid attributes to be appended to the 
formData
+              // while logging error to console for any attribute that fails 
the cast to String
+              val = stringify ? JSON.stringify(value) : String(value);
+            } catch (e) {
+              // eslint-disable-next-line no-console
+              console.error(
+                `Unable to convert attribut '${key}' to a String(). ${key} is 
not part of the formData payload for call to ${url}`,

Review Comment:
   ```suggestion
                   `Unable to convert attribute '${key}' to a String(). ${key} 
is not part of the formData payload for call to ${url}`,
   ```



-- 
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]

Reply via email to