Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Philipp Hörist
gajim
Commits
26612aa8
Commit
26612aa8
authored
Apr 16, 2022
by
Philipp Hörist
Browse files
fix: Exception: Make sure value is set for sentry payload
parent
e89cb1ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
gajim/gtk/exception.py
View file @
26612aa8
...
...
@@ -229,7 +229,8 @@ def _init_sentry(self, endpoint: str) -> None:
default_integrations
=
False
,
shutdown_timeout
=
0
,
auto_session_tracking
=
False
,
before_send
=
self
.
_before_send
)
before_send
=
self
.
_before_send
,
debug
=
False
)
sentry_sdk
.
set_context
(
'os'
,
{
'name'
:
get_os_name
(),
...
...
@@ -247,6 +248,16 @@ def _capture_exception(self) -> None:
sentry_sdk
.
capture_exception
(
self
.
_traceback_data
)
def
_before_send
(
self
,
event
:
dict
[
str
,
Any
],
hint
:
Any
)
->
dict
[
str
,
Any
]:
# Make sure the exception value is set, GitLab needs it.
# The value is the arg which is passed to the Exception.
# e.g. raise Exception('Error')
try
:
value
=
event
[
'exception'
][
'values'
][
0
].
get
(
'value'
)
if
not
value
:
event
[
'exception'
][
'values'
][
0
][
'value'
]
=
'Unknown'
except
Exception
:
pass
# Remove the hostname of the machine
event
[
'server_name'
]
=
''
pprint
.
pprint
(
event
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment