class_docstr: Thrown if a command call fails.
  
  Note: Subclasses should override `to_str` rather than `__str__` because
  `to_str` is called directly in datalad.cli.main.
class_docstr_tok: ["Thrown","if","a","command","call","fails",".","Note",":","Subclasses","should","override","`","to_str","`","rather","than","`","__str__","`","because","`","to_str","`","is","called","directly","in","datalad.cli.main","."]
code: def __init__(
      self,
      cmd: str | list[str] = "",
      msg: str = "",
      code: Optional[int] = None,
      stdout: str | bytes = "",
      stderr: str | bytes = "",
      cwd: str | os.PathLike | None = None,
      **kwargs: Any,
  ) -> None:
      RuntimeError.__init__(self, msg)
      self.cmd = cmd
      self.msg = msg
      self.code = code
      self.stdout = stdout
      self.stderr = stderr
      self.cwd = cwd
      self.kwargs = kwargs
  
file_path: datalad/datalad/runner/exception.py
imports: from __future__ import annotations
  import logging
  import os
  from collections import Counter
  from typing import Any, Optional
label_desc: Use image node_id 1 to create a new CommandError object from inherited base classes: RuntimeError with example: obj = CommandError(cmd, msg, code, stdout, stderr, cwd)