lib.errors module

Custom error handling code lives here.

class BErr(emsg, cause=None, up=0)[source]

Bases: result.result.Err[lib.types.T, BugyiError]

Bugyi Err Type.

Parameters
  • emsg (str) –

  • cause (Optional[Exception]) –

  • up (int) –

exception BugyiError(emsg, cause=None, up=0)[source]

Bases: Exception

Custom general-purpose exception.

Parameters
  • emsg (str) –

  • cause (Optional[Exception]) –

  • up (int) –

report(width=80)[source]

Return an _ErrorReport object formatting the current state of this BugyiError

Parameters

width (int) –

Return type

_ErrorReport

chain_errors(e1, e2)[source]

Chain two exceptions together.

This is the functional equivalent to raise e1 from e2.

Parameters
  • e1 (~E) – An exception.

  • e2 (Optional[Exception]) – The exception we want to chain to e2.

Return type

~E

Returns

e1 after chaining e2 to it.