Skip to content

Commit 05c4c22

Browse files
committed
Improve error message on unavailable config
1 parent 5dde9b9 commit 05c4c22

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/sentry/config.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,13 @@ defmodule Sentry.Config do
502502
@compile {:inline, fetch!: 1}
503503
defp fetch!(key) do
504504
:persistent_term.get({:sentry_config, key})
505+
rescue
506+
ArgumentError ->
507+
raise """
508+
the Sentry configuration seems to be not available (while trying to fetch \
509+
#{inspect(key)}). This is likely because the :sentry application has not been started yet. \
510+
Make sure that you start the :sentry application before using any of its functions.
511+
"""
505512
end
506513

507514
@compile {:inline, fetch!: 1}

0 commit comments

Comments
 (0)