Scalr\Api\Service\User\V1beta0\Controller\Roles::setImage PHP Method

setImage() protected method

It wraps into separate call to avoid code duplicates on catching Exceptions
protected setImage ( )
    protected function setImage()
    {
        $args = func_get_args();
        /* @var $role Entity\Role */
        $role = array_shift($args);
        try {
            call_user_func_array([$role, 'setImage'], $args);
        } catch (OsMismatchException $e) {
            throw new ApiErrorException(409, ErrorMessage::ERR_OS_MISMATCH, $e->getMessage());
        } catch (ImageNotFoundException $e) {
            throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, $e->getMessage());
        } catch (NotAcceptableImageStatusException $e) {
            throw new ApiErrorException(409, ErrorMessage::ERR_UNACCEPTABLE_IMAGE_STATUS, $e->getMessage());
        } catch (ImageInUseException $e) {
            throw new ApiErrorException(409, ErrorMessage::ERR_OBJECT_IN_USE, $e->getMessage());
        } catch (ImageNotScalarizedException $e) {
            throw new ApiErrorException(409, ErrorMessage::ERR_UNACCEPTABLE_IMAGE_STATUS, $e->getMessage());
        }
    }