Skip to content

Commit

Permalink
Treat 404 errors from Kubernetes API as missing values (#93)
Browse files Browse the repository at this point in the history
Rather than relying on the message returned from the kubernetes api
being exactly "Not Found" we now also treat HTTP code 404 as a
missing configuration value. This is much more robust to changes
as it is unlikely that the HTTP status code spec will change while
kubernetes can decide to change the error message at any point in
time.
  • Loading branch information
jakobmerrild authored Nov 15, 2021
1 parent daaca40 commit 8681c4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/ciris/kubernetes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ package object kubernetes {

ConfigValue.default(entries)
} catch {
case cause: ApiException if cause.getMessage == "Not Found" =>
case cause: ApiException if cause.getMessage == "Not Found" || cause.getCode == 404 =>
ConfigValue.missing(configKey)
}
}
Expand All @@ -131,7 +131,7 @@ package object kubernetes {

ConfigValue.default(entries)
} catch {
case cause: ApiException if cause.getMessage == "Not Found" =>
case cause: ApiException if cause.getMessage == "Not Found" || cause.getCode == 404 =>
ConfigValue.missing(configKey)
}
}
Expand Down

0 comments on commit 8681c4d

Please sign in to comment.