From f1d41b8ff3f5b20af3e05e28ef19fae5bf317302 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 6 Apr 2026 19:15:05 +0530 Subject: [PATCH] refactor: update migration exception handling and return type --- app/controllers/api/migrations.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/migrations.php b/app/controllers/api/migrations.php index 67fc21fb48..3a346cf816 100644 --- a/app/controllers/api/migrations.php +++ b/app/controllers/api/migrations.php @@ -63,7 +63,7 @@ function getDatabaseResourceType(string $databaseType): string }; } -function throwMigrationReportProviderException(\Throwable $e): void +function throwMigrationReportProviderException(\Throwable $e): never { $defaultConnectivity = 'Unable to connect to the migration source. Please verify your credentials and ensure the source is reachable from this server. Check for network restrictions such as firewalls, IP allowlists, or outbound connectivity limits.'; @@ -72,9 +72,9 @@ function throwMigrationReportProviderException(\Throwable $e): void continue; } - if ((int) $cur->getCode() === 401 && $cur->getType() === Exception::GENERAL_UNAUTHORIZED_SCOPE) { + if ((int) $cur->getCode() >= 400 && (int) $cur->getCode() < 500) { throw new Exception( - Exception::GENERAL_UNAUTHORIZED_SCOPE, + Exception::MIGRATION_PROVIDER_ERROR, $cur->getMessage() !== '' ? $cur->getMessage() : null ); }