MCPcopy
hub / github.com/pex-tool/pex / create_error

Method create_error

pex/jobs.py:151–174  ·  view source on GitHub ↗

Creates an error with this Job's details. :param msg: The message for the error. :param stderr: Any stderr output captured from the job. :return: A job error.

(
        self,
        msg,  # type: str
        stderr=None,  # type: Optional[bytes]
    )

Source from the content-addressed store, hash-verified

149 self._finalize_job()
150
151 def create_error(
152 self,
153 msg, # type: str
154 stderr=None, # type: Optional[bytes]
155 ):
156 # type: (...) -> Job.Error
157 """Creates an error with this Job's details.
158
159 :param msg: The message for the error.
160 :param stderr: Any stderr output captured from the job.
161 :return: A job error.
162 """
163 err = None
164 if stderr:
165 err = stderr.decode("utf-8")
166 msg += "\nSTDERR:\n{}".format(err)
167 raise self.Error(
168 pid=self._process.pid,
169 command=self._command,
170 exitcode=self._process.returncode,
171 stderr=err,
172 message=msg,
173 context=self._context,
174 )
175
176 def _finalize_job(self):
177 if self._finalizer is not None:

Callers 2

_check_returncodeMethod · 0.95
_read_fileMethod · 0.80

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected