Skip to content

Commit ca39775

Browse files
committed
updates
1 parent 2f4496c commit ca39775

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

components/cal_com/actions/create-booking/create-booking.mjs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import calCom from "../../cal_com.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
23

34
export default {
45
key: "cal_com-create-booking",
@@ -74,11 +75,19 @@ export default {
7475
customInputs: [],
7576
metadata: {},
7677
};
77-
const response = await this.calCom.createBooking({
78-
data,
79-
$,
80-
});
81-
$.export("$summary", `Successfully created booking with ID ${response.id}`);
82-
return response;
78+
try {
79+
const response = await this.calCom.createBooking({
80+
data,
81+
$,
82+
});
83+
$.export("$summary", `Successfully created booking with ID ${response.id}`);
84+
return response;
85+
} catch (error) {
86+
const errorJson = JSON.parse(error.slice(error.indexOf("{")));
87+
const message = errorJson?.data?.message;
88+
throw new ConfigurationError(`Error: ${message}${message === "no_available_users_found_error"
89+
? ". No users are available to be assigned to a booking at the specified time"
90+
: ""}`);
91+
}
8392
},
8493
};

0 commit comments

Comments
 (0)