Skip to content

Commit 31ba835

Browse files
committed
error handling
1 parent 0f887be commit 31ba835

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

components/braintree/actions/create-customer/create-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default {
7777
},
7878
},
7979
});
80-
$.export("$summary", `Customer successfully created with id ${response.data.createCustomer.customer.id}`);
80+
$.export("$summary", `Customer successfully created with ID ${response.data.createCustomer.customer.id}`);
8181
return response;
8282
},
8383
};

components/braintree/braintree.app.mjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { axios } from "@pipedream/platform";
1+
import {
2+
axios, ConfigurationError,
3+
} from "@pipedream/platform";
24

35
export default {
46
type: "app",
57
app: "braintree",
68
propDefinitions: {},
79
methods: {
8-
makeGraphQLRequest({
10+
async makeGraphQLRequest({
911
$ = this, ...opts
1012
}) {
11-
return axios($, {
13+
const response = await axios($, {
1214
method: "post",
1315
url: `https://${this.$auth.environment}.braintree-api.com/graphql`,
1416
headers: {
@@ -21,6 +23,10 @@ export default {
2123
},
2224
...opts,
2325
});
26+
if (response.errors) {
27+
throw new ConfigurationError(response.errors[0].message);
28+
}
29+
return response;
2430
},
2531
},
2632
};

0 commit comments

Comments
 (0)