diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index b2487d0fe30..4e2dd7478b0 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -8,6 +8,7 @@ use App\Exceptions\Handlers\AccessDBDenied; use App\Exceptions\Handlers\AdminSetterHandler; use App\Exceptions\Handlers\InstallationHandler; +use App\Exceptions\Handlers\LegacyIdExceptionHandler; use App\Exceptions\Handlers\MigrationHandler; use App\Exceptions\Handlers\NoEncryptionKey; use App\Exceptions\Handlers\ViteManifestNotFoundHandler; @@ -108,6 +109,7 @@ class Handler extends ExceptionHandler AdminSetterHandler::class, MigrationHandler::class, ViteManifestNotFoundHandler::class, + LegacyIdExceptionHandler::class, ]; /** @var array> */ diff --git a/app/Exceptions/Handlers/LegacyIdExceptionHandler.php b/app/Exceptions/Handlers/LegacyIdExceptionHandler.php new file mode 100644 index 00000000000..2c33955cf62 --- /dev/null +++ b/app/Exceptions/Handlers/LegacyIdExceptionHandler.php @@ -0,0 +1,47 @@ +getMessage(), 'Numeric value out of range: 1264') + ) { + return true; + } + } while ($e = $e->getPrevious()); + + return false; + } + + /** + * {@inheritDoc} + */ + public function renderHttpException(SymfonyResponse $defaultResponse, HttpException $e): SymfonyResponse + { + return response()->view('error.error', [ + 'code' => $e->getStatusCode(), + 'type' => class_basename($e), + 'message' => 'SQLSTATE: Numeric value out of range: 1264 for column \'legacy_id\'. To fix, please set `force_32bit_ids` to `1` in your Settings => More.', + ], $e->getStatusCode(), $e->getHeaders()); + } +}