MCPcopy Create free account
hub / github.com/microsoft/debugpy / error

Method error

src/debugpy/common/messaging.py:501–518  ·  view source on GitHub ↗

Returns a new exception of the specified type from the point at which it is invoked, with the specified formatted message as the reason. The resulting exception will have its cause set to the Message object on which error() was called. Additionally, if that message is a Requ

(self, exc_type, format_string, *args, **kwargs)

Source from the content-addressed store, hash-verified

499 return command == () or self.request.command in command
500
501 def error(self, exc_type, format_string, *args, **kwargs):
502 """Returns a new exception of the specified type from the point at which it is
503 invoked, with the specified formatted message as the reason.
504
505 The resulting exception will have its cause set to the Message object on which
506 error() was called. Additionally, if that message is a Request, a failure
507 response is immediately sent.
508 """
509
510 assert issubclass(exc_type, MessageHandlingError)
511
512 silent = kwargs.pop("silent", False)
513 reason = format_string.format(*args, **kwargs)
514 exc = exc_type(reason, self, silent) # will log it
515
516 if isinstance(self, Request):
517 self.respond(exc)
518 return exc
519
520 def isnt_valid(self, *args, **kwargs):
521 """Same as self.error(InvalidMessageError, ...)."""

Callers 15

isnt_validMethod · 0.95
cant_handleMethod · 0.95
run_codeFunction · 0.80
_handleMethod · 0.80
_handleMethod · 0.80
run_handlersMethod · 0.80
make_error_messageMethod · 0.80
mainFunction · 0.80
_parse_argvFunction · 0.80
__init__Method · 0.80
expect_no_unobservedMethod · 0.80

Calls 2

popMethod · 0.80
respondMethod · 0.80

Tested by

no test coverage detected