fix: only report nonruntime errors
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\InstanceSettings;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use RuntimeException;
|
||||||
use Sentry\Laravel\Integration;
|
use Sentry\Laravel\Integration;
|
||||||
use Sentry\State\Scope;
|
use Sentry\State\Scope;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
@@ -55,7 +56,9 @@ class Handler extends ExceptionHandler
|
|||||||
{
|
{
|
||||||
$this->reportable(function (Throwable $e) {
|
$this->reportable(function (Throwable $e) {
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
ray($e);
|
// return;
|
||||||
|
}
|
||||||
|
if ($e instanceof RuntimeException) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->settings = InstanceSettings::get();
|
$this->settings = InstanceSettings::get();
|
||||||
@@ -74,6 +77,7 @@ class Handler extends ExceptionHandler
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
ray('reporting to sentry');
|
||||||
Integration::captureUnhandledException($e);
|
Integration::captureUnhandledException($e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\S3Storage;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
$this->next(ApplicationDeploymentStatus::FINISHED->value);
|
$this->next(ApplicationDeploymentStatus::FINISHED->value);
|
||||||
$this->application->isConfigurationChanged(true);
|
$this->application->isConfigurationChanged(true);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e);
|
|
||||||
$this->fail($e);
|
$this->fail($e);
|
||||||
throw $e;
|
throw $e;
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -93,65 +93,28 @@ function refreshSession(?Team $team = null): void
|
|||||||
}
|
}
|
||||||
function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null)
|
function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null)
|
||||||
{
|
{
|
||||||
ray('handleError');
|
|
||||||
ray($error);
|
|
||||||
if ($error instanceof Throwable) {
|
|
||||||
$message = $error->getMessage();
|
|
||||||
} else {
|
|
||||||
$message = null;
|
|
||||||
}
|
|
||||||
if ($customErrorMessage) {
|
|
||||||
$message = $customErrorMessage . ' ' . $message;
|
|
||||||
}
|
|
||||||
if ($error instanceof TooManyRequestsException) {
|
if ($error instanceof TooManyRequestsException) {
|
||||||
if (isset($livewire)) {
|
if (isset($livewire)) {
|
||||||
return $livewire->emit('error', "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.");
|
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.";
|
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 (isset($livewire)) {
|
if (isset($livewire)) {
|
||||||
return $livewire->emit('error', $message);
|
return $livewire->emit('error', $message);
|
||||||
}
|
}
|
||||||
|
throw $error;
|
||||||
throw new RuntimeException($message);
|
|
||||||
}
|
}
|
||||||
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
|
function get_route_parameters(): array
|
||||||
{
|
{
|
||||||
return Route::current()->parameters();
|
return Route::current()->parameters();
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
return [
|
return [
|
||||||
|
|
||||||
// @see https://docs.sentry.io/product/sentry-basics/dsn-explainer/
|
// @see https://docs.sentry.io/product/sentry-basics/dsn-explainer/
|
||||||
'dsn' => 'https://c35fe90ee56e18b220bb55e8217d4839@o1082494.ingest.sentry.io/4505347448045568',
|
'dsn' => 'https://396748153b19c469f5ceff50f1664323@o1082494.ingest.sentry.io/4505347448045568',
|
||||||
|
|
||||||
// The release version of your application
|
// The release version of your application
|
||||||
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
// 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
|
// When left empty or `null` the Laravel environment will be used
|
||||||
'environment' => config('app.env'),
|
'environment' => config('app.env'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.145';
|
return '4.0.0-beta.146';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div x-init="$wire.validateServer(false)">
|
<div>
|
||||||
<x-modal yesOrNo modalId="changeLocalhost" modalTitle="Change Localhost" action="submit">
|
<x-modal yesOrNo modalId="changeLocalhost" modalTitle="Change Localhost" action="submit">
|
||||||
<x-slot:modalBody>
|
<x-slot:modalBody>
|
||||||
<p>You could lost a lot of functionalities if you change the server details of the server where Coolify is
|
<p>You could lost a lot of functionalities if you change the server details of the server where Coolify is
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "3.12.36"
|
"version": "3.12.36"
|
||||||
},
|
},
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.145"
|
"version": "4.0.0-beta.146"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user