Skip to content

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.

fix: only report nonruntime errors

Andras Bacsai8f963adbd472
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index b4f63661c9..e78849a07d 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -6,6 +6,7 @@ use App\Models\InstanceSettings;
use App\Models\User;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
+use RuntimeException;
use Sentry\Laravel\Integration;
use Sentry\State\Scope;
use Throwable;
@@ -55,7 +56,9 @@ class Handler extends ExceptionHandler
{
$this->reportable(function (Throwable $e) {
if (isDev()) {
- ray($e);
+ // return;
+ }
+ if ($e instanceof RuntimeException) {
return;
}
$this->settings = InstanceSettings::get();
@@ -74,6 +77,7 @@ class Handler extends ExceptionHandler
);
}
);
+ ray('reporting to sentry');
Integration::captureUnhandledException($e);
});
}
diff --git a/app/Http/Livewire/Dashboard.php b/app/Http/Livewire/Dashboard.php
index 723b00f7f3..b7219864df 100644
--- a/app/Http/Livewire/Dashboard.php
+++ b/app/Http/Livewire/Dashboard.php
@@ -3,7 +3,6 @@
namespace App\Http\Livewire;
use App\Models\Project;
-use App\Models\S3Storage;
use App\Models\Server;
use Livewire\Component;
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index dacdbf89b0..32f92aefd8 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -218,7 +218,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->next(ApplicationDeploymentStatus::FINISHED->value);
$this->application->isConfigurationChanged(true);
} catch (Exception $e) {
- ray($e);
$this->fail($e);
throw $e;
} finally {
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 6e3c6ca4f6..1953f554df 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -93,65 +93,28 @@ function refreshSession(?Team $team = null): void
}
function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null)
{
- ray('handleError');
- ray($error);
+ if ($error instanceof TooManyRequestsException) {
+ if (isset($livewire)) {
+ return $livewire->emit('error', "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.");
+ }
+ return "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.";
+ }
+
if ($error instanceof Throwable) {
$message = $error->getMessage();
} else {
$message = null;
}
if ($customErrorMessage) {
+ $error->message = $customErrorMessage . ' ' . $message;
$message = $customErrorMessage . ' ' . $message;
}
- if ($error instanceof TooManyRequestsException) {
- if (isset($livewire)) {
- return $livewire->emit('error', "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.");
- }
- return "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.";
- }
+
if (isset($livewire)) {
return $livewire->emit('error', $message);
}
-
- throw new RuntimeException($message);
+ throw $error;
}
-function general_error_handler(Throwable $err, Livewire\Component $that = null, $isJson = false, $customErrorMessage = null): mixed
-{
- try {
- ray($err);
- ray('ERROR OCCURRED: ' . $err->getMessage());
- if ($err instanceof QueryException) {
- if ($err->errorInfo[0] === '23505') {
- throw new Exception($customErrorMessage ?? 'Duplicate entry found.', '23505');
- } else if (count($err->errorInfo) === 4) {
- throw new Exception($customErrorMessage ?? $err->errorInfo[3]);
- } else {
- throw new Exception($customErrorMessage ?? $err->errorInfo[2]);
- }
- } elseif ($err instanceof TooManyRequestsException) {
- throw new Exception($customErrorMessage ?? "Too many requests. Please try again in {$err->secondsUntilAvailable} seconds.");
- } else {
- if ($err->getMessage() === 'This action is unauthorized.') {
- return redirect()->route('dashboard')->with('error', $customErrorMessage ?? $err->getMessage());
- }
- throw new Exception($customErrorMessage ?? $err->getMessage());
- }
- } catch (\Throwable $e) {
- if ($that) {
- return $that->emit('error', $customErrorMessage ?? $e->getMessage());
- } elseif ($isJson) {
- return response()->json([
- 'code' => $e->getCode(),
- 'error' => $e->getMessage(),
- ]);
- } else {
- ray($customErrorMessage);
- ray($e);
- return $customErrorMessage ?? $e->getMessage();
- }
- }
-}
-
function get_route_parameters(): array
{
return Route::current()->parameters();
diff --git a/config/sentry.php b/config/sentry.php
index 2d3302d481..38c7355e9e 100644
--- a/config/sentry.php
+++ b/config/sentry.php
@@ -3,11 +3,11 @@
return [
// @see https://docs.sentry.io/product/sentry-basics/dsn-explainer/
- 'dsn' => 'https://[email protected]/4505347448045568',
+ 'dsn' => 'https://[email protected]/4505347448045568',
// The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
- 'release' => '4.0.0-beta.145',
+ 'release' => '4.0.0-beta.146',
// When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'),
diff --git a/config/version.php b/config/version.php
index 9bbb31a9f6..8c257643ae 100644
--- a/config/version.php
+++ b/config/version.php
@@ -1,3 +1,3 @@
<?php
-return '4.0.0-beta.145';
+return '4.0.0-beta.146';
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php
index c36d34cbc3..e872751f93 100644
--- a/resources/views/livewire/server/form.blade.php
+++ b/resources/views/livewire/server/form.blade.php
@@ -1,4 +1,4 @@
-<div x-init="$wire.validateServer(false)">
+<div>
<x-modal yesOrNo modalId="changeLocalhost" modalTitle="Change Localhost" action="submit">
<x-slot:modalBody>
<p>You could lost a lot of functionalities if you change the server details of the server where Coolify is
diff --git a/versions.json b/versions.json
index d2bd0be29b..905876d7a5 100644
--- a/versions.json
+++ b/versions.json
@@ -4,7 +4,7 @@
"version": "3.12.36"
},
"v4": {
- "version": "4.0.0-beta.145"
+ "version": "4.0.0-beta.146"
}
}
}