fix: truncate long error messages in test email display
Show only first line of error for cleaner UI, full details still logged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -475,9 +475,11 @@ function adminSettings() {
|
||||
this.testEmailSuccess = null;
|
||||
|
||||
try {
|
||||
settingsLog.info('Sending test email to:', this.testEmailAddress);
|
||||
const data = await apiClient.post('/admin/settings/email/test', {
|
||||
to_email: this.testEmailAddress
|
||||
});
|
||||
settingsLog.info('Test email response:', data);
|
||||
|
||||
if (data.success) {
|
||||
this.testEmailSuccess = `Test email sent to ${this.testEmailAddress}`;
|
||||
@@ -485,13 +487,20 @@ function adminSettings() {
|
||||
this.testEmailSuccess = null;
|
||||
}, 5000);
|
||||
} else {
|
||||
this.testEmailError = data.message || 'Failed to send test email';
|
||||
settingsLog.error('Test email failed:', data.message);
|
||||
// Extract the first line of error for cleaner display
|
||||
let errorMsg = data.message || 'Failed to send test email';
|
||||
if (errorMsg.includes('\n')) {
|
||||
errorMsg = errorMsg.split('\n')[0];
|
||||
}
|
||||
this.testEmailError = errorMsg;
|
||||
}
|
||||
} catch (error) {
|
||||
settingsLog.error('Failed to send test email:', error);
|
||||
settingsLog.error('Failed to send test email (exception):', error);
|
||||
this.testEmailError = error.message || 'Failed to send test email';
|
||||
} finally {
|
||||
this.sendingTestEmail = false;
|
||||
settingsLog.info('sendingTestEmail set to false, testEmailError:', this.testEmailError);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user