chore: Standardize error message extraction in contact form actions and mailer, and add Directus restart to the Directus sync script.
All checks were successful
Build & Deploy KLZ Cables / 🔍 Prepare Environment (push) Successful in 14s
Build & Deploy KLZ Cables / 🧪 Quality Assurance (push) Has been skipped
Build & Deploy KLZ Cables / 🏗️ Build App (push) Has been skipped
Build & Deploy KLZ Cables / 🚀 Deploy (push) Has been skipped
Build & Deploy KLZ Cables / ⚡ PageSpeed (push) Has been skipped
Build & Deploy KLZ Cables / 🔔 Notifications (push) Successful in 2s

This commit is contained in:
2026-02-06 17:55:43 +01:00
parent 8a751998eb
commit d027fbeac2
4 changed files with 18 additions and 6 deletions

View File

@@ -111,13 +111,20 @@ export async function sendContactFormAction(formData: FormData) {
return { success: true }; return { success: true };
} catch (error) { } catch (error) {
logger.error('Failed to send branded emails', { error }); const errorMsg = error instanceof Error ? error.message : String(error);
logger.error('Failed to send branded emails', {
error: errorMsg,
stack: error instanceof Error ? error.stack : undefined,
});
services.errors.captureException(error, { action: 'sendContactFormAction', email }); services.errors.captureException(error, { action: 'sendContactFormAction', email });
await services.notifications.notify({ await services.notifications.notify({
title: '🚨 Contact Form Error', title: '🚨 Contact Form Error',
message: `Failed to send emails for ${name} (${email}). Error: ${JSON.stringify(error)}`, message: `Failed to send emails for ${name} (${email}). Error: ${errorMsg}`,
priority: 8, priority: 8,
}); });
return { success: false, error };
return { success: false, error: errorMsg };
} }
} }

View File

@@ -20,7 +20,7 @@ export default function ContactForm() {
try { try {
const result = await sendContactFormAction(formData); const result = await sendContactFormAction(formData);
if (result.success) { if (result?.success) {
trackEvent('contact_form_submission', { trackEvent('contact_form_submission', {
form_type: 'general', form_type: 'general',
email, email,

View File

@@ -48,7 +48,8 @@ export async function sendEmail({ to, subject, html }: SendEmailOptions) {
logger.info('Email sent successfully', { messageId: info.messageId, subject, recipients }); logger.info('Email sent successfully', { messageId: info.messageId, subject, recipients });
return { success: true, messageId: info.messageId }; return { success: true, messageId: info.messageId };
} catch (error) { } catch (error) {
logger.error('Error sending email', { error, subject, recipients }); const errorMsg = error instanceof Error ? error.message : String(error);
return { success: false, error }; logger.error('Error sending email', { error: errorMsg, subject, recipients });
return { success: false, error: errorMsg };
} }
} }

View File

@@ -97,6 +97,10 @@ if [ "$ACTION" == "push" ]; then
rm dump.sql rm dump.sql
ssh "$REMOTE_HOST" "rm $REMOTE_DIR/dump.sql" ssh "$REMOTE_HOST" "rm $REMOTE_DIR/dump.sql"
# 5. Restart Directus to trigger migrations and refresh schema cache
echo "🔄 Restarting remote Directus to apply migrations..."
ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose -p $PROJECT_NAME restart directus"
echo "✨ Push to $ENV complete!" echo "✨ Push to $ENV complete!"
elif [ "$ACTION" == "pull" ]; then elif [ "$ACTION" == "pull" ]; then