mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
fix(backend): correctly handle sentry config errors
This commit is contained in:
committed by
Łukasz Mierzwa
parent
c5d6499bdd
commit
20138a696e
@@ -373,7 +373,8 @@ func mainSetup(errorHandling pflag.ErrorHandling) (*chi.Mux, error) {
|
||||
Dsn: config.Config.Sentry.Public,
|
||||
Release: version,
|
||||
}); err != nil {
|
||||
log.Error().Err(err).Msg("Sentry initialization failed")
|
||||
log.Error().Err(err).Str("dsn", config.Config.Sentry.Public).Msg("Sentry initialization failed")
|
||||
return nil, fmt.Errorf("sentry configuration is invalid")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
cmd/karma/tests/testscript/086_sentry_invalid_dsn.txt
Normal file
19
cmd/karma/tests/testscript/086_sentry_invalid_dsn.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
# Invalid sentry DSN raises an error
|
||||
|
||||
karma.bin-should-fail --config.file=karma.yaml --check-config
|
||||
! stdout .
|
||||
cmp stderr stderr.txt
|
||||
|
||||
-- stderr.txt --
|
||||
level=info msg="Reading configuration file" path=karma.yaml
|
||||
level=info msg="Version: dev"
|
||||
level=info msg="Configured Alertmanager source" name=default proxy=false readonly=false uri=http://127.0.0.1:9093
|
||||
level=error msg="Sentry initialization failed" error="[Sentry] DsnParseError: invalid scheme" dsn=abcd
|
||||
level=error msg="Execution failed" error="sentry configuration is invalid"
|
||||
-- karma.yaml --
|
||||
alertmanager:
|
||||
servers:
|
||||
- name: default
|
||||
uri: http://127.0.0.1:9093
|
||||
sentry:
|
||||
public: abcd
|
||||
Reference in New Issue
Block a user