Activiti-Rest-Client

 view release on metacpan or  search on metacpan

lib/Activiti/Rest/Response.pm  view on Meta::CPAN

        message => $res->message,
        content => $res->content,
        content_type => $ct,
        error_message => $exception,
        exception => $exception
    };


    #The operation failed. The operation requires an Authentication header to be set. If this was present in the request, the supplied credentials are not valid or the user is not authorized to perform this operation.
    if($code eq "401"){
      Activiti::Rest::Error::UnAuthorized->throw($args);
    }

    #The operation is forbidden and should not be re-attempted. This does not imply an issue with authentication not authorization, it's an operation that is not allowed. Example: deleting a task that is part of a running process is not allowed and w...
    elsif($code eq "403"){
      Activiti::Rest::Error::Forbidden->throw($args);
    }

    #The operation failed.The requested resource was not found.
    elsif($code eq "404"){
      Activiti::Rest::Error::NotFound->throw($args);
    }

    #The operation failed. The used method is not allowed for this resource. Eg. trying to update (PUT) a deployment-resource will result in a 405 status.
    elsif($code eq "405"){
      Activiti::Rest::Error::MethodNotAllowed->throw($args);
    }

    #The operation failed. The operation causes an update of a resource that has been updated by another operation, which makes the update no longer valid. Can also indicate a resource that is being created in a collection where a resource with that ...
    elsif($code eq "409"){
      Activiti::Rest::Error::Conflict->throw($args);
    }

    #The operation failed. The request body contains an unsupported media type. Also occurs when the request-body JSON contains an unknown attribute or value that doesn't have the right format/type to be accepted.
    elsif($code eq "415"){
      Activiti::Rest::Error::UnsupportedMediaType->throw($args);
    }

    #The operation failed. An unexpected exception occurred while executing the operation. The response-body contains details about the error.
    elsif($code eq "500"){
      Activiti::Rest::Error::InternalServerError->throw($args);
    }

    #common error
    else{
      Activiti::Rest::Error->throw($args);
    }

  }

  my $content_type = $res->header('Content-Type');
  my $content_length = $res->header('Content-Length');

  my(%new_args) = (
    code => $res->code,
    content_type => $content_type



( run in 0.438 second using v1.01-cache-2.11-cpan-496ff517765 )