From d3c7899b07b77eed558e53dbee346e844555c66a Mon Sep 17 00:00:00 2001 From: Alberto Schiabel Date: Thu, 18 Jan 2024 10:48:42 +0100 Subject: [PATCH] fix(user-facing-errors): fix Prisma pipeline, add sqlserver test to sql-migration-tests (#4651) * fix(user-facing-errors): fix Prisma pipeline, add sqlserver test to sql-migration-tests * chore(driver-adapters): got rid of broken sqlserver test case --- libs/user-facing-errors/src/quaint.rs | 6 ++++++ .../sql-migration-tests/tests/errors/error_tests.rs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/libs/user-facing-errors/src/quaint.rs b/libs/user-facing-errors/src/quaint.rs index c2e73948dcfb..b125f2114618 100644 --- a/libs/user-facing-errors/src/quaint.rs +++ b/libs/user-facing-errors/src/quaint.rs @@ -229,6 +229,12 @@ pub fn render_quaint_error(kind: &ErrorKind, connection_info: &ConnectionInfo) - database_host: url.host().to_owned(), })) } + (NativeErrorKind::ConnectionError(_), ConnectionInfo::Native(NativeConnectionInfo::Mssql(url))) => { + Some(KnownError::new(common::DatabaseNotReachable { + database_port: url.port(), + database_host: url.host().to_owned(), + })) + } (NativeErrorKind::TlsError { message }, _) => Some(KnownError::new(common::TlsConnectionError { message: message.into(), })), diff --git a/schema-engine/sql-migration-tests/tests/errors/error_tests.rs b/schema-engine/sql-migration-tests/tests/errors/error_tests.rs index 76a18c984fd0..7d60c3ee8052 100644 --- a/schema-engine/sql-migration-tests/tests/errors/error_tests.rs +++ b/schema-engine/sql-migration-tests/tests/errors/error_tests.rs @@ -90,6 +90,10 @@ fn authentication_failure_must_return_a_known_error_on_mysql(api: TestApi) { assert_eq!(json_error, expected); } +// TODO(tech-debt): get rid of provider-specific PSL `dm` declaration, and use `test_api::datamodel_with_provider` utility instead. +// See: https://github.com/prisma/team-orm/issues/835. +// This issue also currently prevents us from defining an `Mssql`-specific copy of this `unreachable_database_*` test case, +// due to url parsing differences between the `url` crate and `quaint`'s `MssqlUrl` struct. #[test_connector(tags(Mysql))] fn unreachable_database_must_return_a_proper_error_on_mysql(api: TestApi) { let mut url: Url = api.connection_string().parse().unwrap();