/**
* Always throws an izzum exception (converts a non-izzum exception to an
* izzum exception)
*
* @param \Exception $e
* @param int $code
* if the exception is not of type Exception, wrap it and use
* this code.
* @param Transition $transition
* optional. if set, we handle it as a transition exception too
* so it can be logged or handled
* @throws Exception an izzum exception
*/
protected function handlePossibleNonStatemachineException(\Exception $e, $code, $transition = null)
{
$e = Utils::wrapToStateMachineException($e, $code);
if ($transition !== null) {
$this->handleTransitionException($transition, $e);
}
throw $e;
}