refactor: update migration exception handling and return type

This commit is contained in:
ArnabChatterjee20k
2026-04-06 19:15:05 +05:30
parent c15db72879
commit f1d41b8ff3
+3 -3
View File
@@ -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
);
}