An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat(exceptions): introduce NonReportableException to handle known errors and update Handler for selective reporting
Andras Bacsaia243b99df456
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 275de57c00..3d731223d6 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -29,6 +29,7 @@ class Handler extends ExceptionHandler*/protected $dontReport = [ProcessException::class,+ NonReportableException::class,];/**@@ -110,9 +111,14 @@ class Handler extends ExceptionHandler);});+ // Check for errors that should not be reported to Sentryif (str($e->getMessage())->contains('No space left on device')) {+ // Log locally but don't send to Sentry+ logger()->warning('Disk space error: '.$e->getMessage());+return;}+Integration::captureUnhandledException($e);});}diff --git a/app/Exceptions/NonReportableException.php b/app/Exceptions/NonReportableException.phpnew file mode 100644index 0000000000..4c4672127f--- /dev/null+++ b/app/Exceptions/NonReportableException.php@@ -0,0 +1,31 @@+<?php++namespace App\Exceptions;++use Exception;++/**+ * Exception that should not be reported to Sentry or other error tracking services.+ * Use this for known, expected errors that don't require external tracking.+ */+class NonReportableException extends Exception+{+ /**+ * Create a new non-reportable exception instance.+ *+ * @param string $message+ * @param int $code+ */+ public function __construct($message = '', $code = 0, ?\Throwable $previous = null)+ {+ parent::__construct($message, $code, $previous);+ }++ /**+ * Create from another exception, preserving its message and stack trace.+ */+ public static function fromException(\Throwable $exception): static+ {+ return new static($exception->getMessage(), $exception->getCode(), $exception);+ }+}diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.phpindex 47994c6906..245bd85f02 100644--- a/app/Notifications/Channels/EmailChannel.php+++ b/app/Notifications/Channels/EmailChannel.php@@ -2,6 +2,7 @@namespace App\Notifications\Channels;+use App\Exceptions\NonReportableException;use App\Models\Team;use Exception;use Illuminate\Notifications\Notification;@@ -101,13 +102,11 @@ class EmailChannel$mailer->send($email);}} catch (\Throwable $e) {- \Illuminate\Support\Facades\Log::error('EmailChannel failed: '.$e->getMessage(), [- 'notification' => get_class($notification),- 'notifiable' => get_class($notifiable),- 'team_id' => data_get($notifiable, 'id'),- 'error' => $e->getMessage(),- 'trace' => $e->getTraceAsString(),- ]);+ // Check if this is a Resend domain verification error on cloud instances+ if (isCloud() && str_contains($e->getMessage(), 'domain is not verified')) {+ // Throw as NonReportableException so it won't go to Sentry+ throw NonReportableException::fromException($e);+ }throw $e;}}