private function exception(Exception $exception) { $this->log($exception->getMessage(), 1, 2); switch (true) { case $exception instanceof CardinityException\Request: if ($exception->getErrorsAsString()) { $this->log($exception->getErrorsAsString(), 1, 2); } break; case $exception instanceof CardinityException\InvalidAttributeValue: foreach ($exception->getViolations() as $violation) { $this->log($violation->getMessage(), 1, 2); } break; } }