We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 841f337 commit ded7bb8Copy full SHA for ded7bb8
components/sendgrid/actions/create-send/create-send.mjs
@@ -150,10 +150,12 @@ export default {
150
$.export("$summary", `Successfully created single send ${this.name}`);
151
return resp;
152
} catch (e) {
153
- const errors = e.split("Unexpected error (status code: ERR_BAD_REQUEST):")[1];
154
- const errorJson = JSON.parse(errors);
155
-
156
- throw new ConfigurationError(errorJson.data.errors[0].message);
+ } catch (e) {
+ if (e.response && e.response.data && e.response.data.errors && e.response.data.errors.length > 0) {
+ throw new ConfigurationError(e.response.data.errors[0].message);
+ } else {
157
+ throw new ConfigurationError("An unexpected error occurred.");
158
+ }
159
}
160
},
161
};
0 commit comments