Skip to content
Snippets Groups Projects
Unverified Commit 051534fe authored by dpsutton's avatar dpsutton Committed by GitHub
Browse files

Fix mysql humanize error (#23263)

* Correctly handle fall-through case.

Condp is exhaustive and throws if nothing matches

```
mysql=> (condp = 2
          1 :nope
          3 :nope)
Execution error (IllegalArgumentException) at metabase.driver.mysql/eval169387 (REPL:870).
No matching clause: 2
mysql=>
```

and can take a single default clause at the end with no predicate

```clojure
mysql=> (condp = 2
          1 :nope
          :default-catch-all)
:default-catch-all
```

This was attempted with a regex `#".*"` but this regex does not match
everything!

```clojure
mysql=> (driver/humanize-connection-error-message :mysql
                                                  "hello\nthere")
Execution error (IllegalArgumentException) at metabase.driver.mysql/eval167431$fn (mysql.clj:124).
No matching clause: hello
there
mysql=> (re-matches #".*" "hi\nthere")
nil
```

So just use use the message as the default to be returned which was the
original intention.

* Fix other databases as well
parent 91da786b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment