mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-11 08:43:24 +00:00
Fix error handling and improve error messages
- Fix inconsistent error handling in sendEmailTask by re-throwing original Error instances - Preserve stack traces and error context instead of creating new Error wrappers - Improve generic error messages in emailProcessor utilities with specific details - Add actionable guidance for common configuration issues - Help developers understand what went wrong and how to fix it - Bump version to 0.4.1
This commit is contained in:
@@ -242,9 +242,11 @@ export const sendEmailJob = {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
// Re-throw Error instances to preserve stack trace and error context
|
||||
if (error instanceof Error) {
|
||||
throw new Error(`Failed to process email: ${error.message}`, { cause: error })
|
||||
throw error
|
||||
} else {
|
||||
// Only wrap non-Error values
|
||||
throw new Error(`Failed to process email: ${String(error)}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user