From dd8766cea7d0e14f9524188a67ecdb9093d085d4 Mon Sep 17 00:00:00 2001 From: John Bakhmat Date: Fri, 31 May 2024 21:25:44 +0300 Subject: [PATCH] Explicitly return error on incorrect scheme --- src/gleam/pgo.gleam | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gleam/pgo.gleam b/src/gleam/pgo.gleam index bb5a92f..65d8c2e 100644 --- a/src/gleam/pgo.gleam +++ b/src/gleam/pgo.gleam @@ -93,8 +93,10 @@ pub fn url_config(database_url: String) -> Result(Config, Nil) { path: path, .., ) -> { - let assert True = list.contains(["postgres", "postgresql"], scheme) - Ok(#(userinfo, host, path, db_port)) + case list.contains(["postgres", "postgresql"], scheme) { + True -> Ok(#(userinfo, host, path, db_port)) + False -> Error(Nil) + } } _ -> Error(Nil) })