craft_providers.errors module

Craft provider errors.

exception craft_providers.errors.ProviderError(brief: str, details: Optional[str] = None, resolution: Optional[str] = None)[source]

Bases: Exception

Unexpected error.

Parameters
  • brief (str) – Brief description of error.

  • details (Optional[str]) – Detailed information.

  • resolution (Optional[str]) – Recommendation, if any.

brief: str
details: Optional[str] = None
resolution: Optional[str] = None
craft_providers.errors.details_from_called_process_error(error)[source]

Create a consistent ProviderError from command errors.

Parameters

error (CalledProcessError) – CalledProcessError.

Return type

str

Returns

Details string.

craft_providers.errors.details_from_command_error(*, cmd, returncode, stdout=None, stderr=None)[source]

Create a consistent ProviderError from command errors.

stdout and stderr, if provided, will be stringified using its object representation. This method does not decode byte strings.

Parameters
  • cmd (List[str]) – Command executed.

  • returncode (int) – Command exit code.

  • stdout (Union[str, bytes, None]) – Optional stdout to include.

  • stderr (Union[str, bytes, None]) – Optional stderr to include.

Return type

str

Returns

Details string.