File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
components/cal_com/actions/create-booking Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 11import calCom from "../../cal_com.app.mjs" ;
2+ import { ConfigurationError } from "@pipedream/platform" ;
23
34export 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} ;
You can’t perform that action at this time.
0 commit comments