@@ -87,7 +87,13 @@ export class HooksService {
8787 }
8888
8989 // Handle the event asynchronously
90- void this . dispatchAndHandleWebhook ( event , subscription , serviceAccount , aggregationStartDate ) ;
90+ void this . dispatchAndHandleWebhook ( event , subscription , serviceAccount , aggregationStartDate )
91+ . catch ( ( err : Error ) => {
92+ this . logger . error ( {
93+ message : `Error while processing the event ${ event . id } ` ,
94+ error : err ?. stack ?? err ,
95+ } ) ;
96+ } ) ;
9197
9298 return ;
9399 }
@@ -125,17 +131,35 @@ export class HooksService {
125131 break ;
126132 // The default case should never be reached, as the eventName is already checked in the DTO
127133 default :
128- void se . update ( { status : EventStatus . FAILED } ) ;
134+ void se . update ( { status : EventStatus . FAILED } )
135+ . catch ( ( statusError : Error ) => {
136+ this . logger . error ( {
137+ message : `Unable to update the event ${ event . id } 's status to FAILED` ,
138+ error : statusError ?. stack ?? statusError ,
139+ } ) ;
140+ } ) ;
129141
130142 return ;
131143 }
132144 } catch ( err ) {
133- void se . update ( { status : EventStatus . ERROR } ) ;
145+ void se . update ( { status : EventStatus . ERROR } )
146+ . catch ( ( statusError : Error ) => {
147+ this . logger . error ( {
148+ message : `Unable to update the event ${ event . id } 's status to ERROR` ,
149+ error : statusError ?. stack ?? statusError ,
150+ } ) ;
151+ } ) ;
134152
135153 throw err ;
136154 }
137155
138- void se . update ( { status : EventStatus . PROCESSED } ) ;
156+ void se . update ( { status : EventStatus . PROCESSED } )
157+ . catch ( ( statusError : Error ) => {
158+ this . logger . error ( {
159+ message : `Unable to update the event ${ event . id } 's status to PROCESSED` ,
160+ error : statusError ?. stack ?? statusError ,
161+ } ) ;
162+ } ) ;
139163 }
140164
141165 /**
0 commit comments