annotate `secondarySources` with `{.raises.}` (#5012)

`sources.addConfigFile` may raise `ConfigurationError`, annotate caller
to propagate that error explicitly.
This commit is contained in:
Etan Kissling 2023-05-31 21:28:33 +02:00 committed by GitHub
parent 73b3f40e8d
commit 6cd63a89d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -200,7 +200,9 @@ template makeBannerAndConfig*(clientId: string, ConfType: type): untyped =
ConfType.load(
version = version, # but a short version string makes more sense...
copyrightBanner = clientId,
secondarySources = proc (config: ConfType, sources: auto) =
secondarySources = proc (
config: ConfType, sources: auto
) {.raises: [ConfigurationError].} =
if config.configFile.isSome:
sources.addConfigFile(Toml, config.configFile.get)
)