Skip to content

Commit

Permalink
Don't attempt to expand errors if there are no variables
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleroy committed Feb 20, 2022
1 parent 42afb14 commit 916a067
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/dap/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ def __init__(self, message: str, url: str|None = None, urlLabel: str|None = None
def from_message(message: dap.Message):
# why on earth does the optional error details have variables that need to be formatted in it????????
format = message.format or 'No error reason given'
variables: dict[str, str] = _DefaultDict(**(message.variables or {}))
error_message = format.format_map(variables)
return Error(error_message, message.url, message.urlLabel)
if message.variables:
variables: dict[str, str] = _DefaultDict(**(message.variables))
error_message = format.format_map(variables)
return Error(error_message, message.url, message.urlLabel)

return Error(format, message.url, message.urlLabel)


0 comments on commit 916a067

Please sign in to comment.