fix: only report nonruntime errors
This commit is contained in:
parent
8f2c24d7e9
commit
8f963adbd4
@ -6,6 +6,7 @@
|
||||
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 @@ public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
if (isDev()) {
|
||||
ray($e);
|
||||
// return;
|
||||
}
|
||||
if ($e instanceof RuntimeException) {
|
||||
return;
|
||||
}
|
||||
$this->settings = InstanceSettings::get();
|
||||
@ -74,6 +77,7 @@ function (Scope $scope) {
|
||||
);
|
||||
}
|
||||
);
|
||||
ray('reporting to sentry');
|
||||
Integration::captureUnhandledException($e);
|
||||
});
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\S3Storage;
|
||||
use App\Models\Server;
|
||||
use Livewire\Component;
|
||||
|
||||
|
@ -218,7 +218,6 @@ public function handle(): void
|
||||
$this->next(ApplicationDeploymentStatus::FINISHED->value);
|
||||
$this->application->isConfigurationChanged(true);
|
||||
} catch (Exception $e) {
|
||||
ray($e);
|
||||
$this->fail($e);
|
||||
throw $e;
|
||||
} finally {
|
||||
|
@ -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 Throwable) {
|
||||
$message = $error->getMessage();
|
||||
} else {
|
||||
$message = null;
|
||||
}
|
||||
if ($customErrorMessage) {
|
||||
$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 ($error instanceof Throwable) {
|
||||
$message = $error->getMessage();
|
||||
} else {
|
||||
$message = null;
|
||||
}
|
||||
if ($customErrorMessage) {
|
||||
$error->message = $customErrorMessage . ' ' . $message;
|
||||
$message = $customErrorMessage . ' ' . $message;
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -3,11 +3,11 @@
|
||||
return [
|
||||
|
||||
// @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
|
||||
// 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'),
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?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-slot:modalBody>
|
||||
<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"
|
||||
},
|
||||
"v4": {
|
||||
"version": "4.0.0-beta.145"
|
||||
"version": "4.0.0-beta.146"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user