@@ -66,7 +66,7 @@ async function resolveOrgAndMailserver({
66
66
}
67
67
} ) ;
68
68
if ( ! rootEmailIdentity )
69
- throw new Error ( `No email identity found for root email` ) ;
69
+ throw new Error ( `No email identity found for root email: ${ rcpt_to } ` ) ;
70
70
return {
71
71
orgId : rootEmailIdentity . orgId ,
72
72
orgPublicId : rootEmailIdentity . org . publicId ,
@@ -119,7 +119,12 @@ async function resolveOrgAndMailserver({
119
119
}
120
120
} ) ;
121
121
if ( ! mailServer || mailServer . orgId !== orgId )
122
- throw new Error ( `Mailserver not found or does not belong to the org` ) ;
122
+ throw new Error (
123
+ `Mailserver not found or does not belong to the org ${ JSON . stringify ( {
124
+ orgId,
125
+ mailserverId
126
+ } ) } `
127
+ ) ;
123
128
124
129
return {
125
130
orgId : mailServer . orgId ,
@@ -493,7 +498,9 @@ export const worker = createWorker<MailProcessorJobData>(
493
498
span ?. setAttributes ( {
494
499
'message.addressIds' : JSON . stringify ( messageAddressIds )
495
500
} ) ;
496
- throw new Error ( 'No email identity ids found' ) ;
501
+ throw new Error (
502
+ `No email identity ids found: ${ JSON . stringify ( messageAddressIds , null , 2 ) } `
503
+ ) ;
497
504
}
498
505
499
506
// get the routing rule destinations for each of the email addresses, then get the users and contacts within those routing rules
@@ -1014,7 +1021,7 @@ export const worker = createWorker<MailProcessorJobData>(
1014
1021
} ) ;
1015
1022
} catch ( e ) {
1016
1023
span ?. recordException ( e as Error ) ;
1017
- console . error ( 'Error processing email' ) ;
1024
+ console . error ( 'Error processing email' , e ) ;
1018
1025
await discord . info ( `Mailbridge Queue Error\n${ ( e as Error ) . message } ` ) ;
1019
1026
// Throw the error to be caught by the worker, and moving to failed jobs
1020
1027
throw e ;
0 commit comments