MOSES::MOBY::ServiceException -
use MOSES::MOBY::ServiceException; # initialize %params as you see fit, for example: my %params = ( code => INPUTS_INVALID(), severity => ERROR(), jobId => 'a1', dataName => 'myBasicGFFSequenceFeature', message => 'there was something wrong with GFF' ); my $serviceException = MOSES::MOBY::ServiceException->new(%params); my $articleName = $serviceException->dataName(); $serviceException->dataName($articleName); my $code = $serviceException->code(); $serviceException->code($code); my $formattedText = $serviceException->formatString(2); my $errorString = $serviceException->getErrorCodeAsString(); my $severityString = $serviceException->getSeverityAsString(); my $jobId = $serviceException->jobId(); $serviceException->jobId(id => $jobId); my $message = $serviceException->message(); $serviceException->message($message); my $severityCode = $serviceException->severity(); $serviceException->severity($severityCode); my $string = $serviceException->toString(); my $domElement = $serviceException->toXML(); #instantiate ServiceException objects flexibly: # for an error (set up params as appropriate) %params = (code => OK(), msg => "ERROR ERROR ERROR"); $serviceException = MOSES::MOBY::ServiceException::error(%params); # for info (set up params as appropriate) %params = (msg => "INFO INFO INFO"); $serviceException = MOSES::MOBY::ServiceException::info(%params); # for a warning (set up params as appropriate) %params = (msg => "WARN WARN WARN"); $serviceException = MOSES::MOBY::ServiceException::warning(%params);
This module encapsulates a Moby service exception raised by service providers when something wrong has to be reported to a client. These exceptions are carried in the service notes part of a MobyPackage. Also included in this module are constances for known error codes and for exception severity levels.
Details are in MOSES::MOBY::Base. Here just a list of them:
An integer representing a severity code.
An integer representing an error code.
A texual message explaining this exception.
An identifier of a job that caused this exception.
An article name containing the offending data input.
Create an instance of ServiceException that represents an info exception. An argument is a message text.
info exception
Create an instance of ServiceException that represents an warning exception. An argument is a message text.
warning exception
Create an instance of ServiceException that represents an error. It has either a single argument representing an error message, or a hash with recognized keys code and msg.
code
msg
exception>. An argument is a message text. Function : Create an instance of ServiceException that represents an error. Returns : An instance of ServiceException Args : An optional Hash argument with any or all of the following: code: an error code
Extract and return all exceptions from the given serviceNotes XML element.
This is a convenient method that can be used when dealing with an XML response from a service without parsing the whole response to a Moby::Package.
An argument is an XML::LibXML::Element containing the serviceNotes (a place where are stored exceptions).
XML::LibXML::Element
Returned value is a reference to an array of MOSES::MOBY::ServiceExceptions. Return a reference to an empty array if there are no exceptions.
MOSES::MOBY::ServiceException
Return the current severity level as text. Or an empty string if the severity code is unknown.
Return a stringified form of the error code associated with this exception. Or an empty string if the error code is unknown.
The following subroutines represents all error codes and similar constants, as defined by BioMoby API.
Returns A severity code that corresponds to a fatal error
No arguments
Returns a severity code that corresponds to an informative diagnostic message
Returns a severity code that corresponds to a message not related to any error
Returns an error code: No error. Used together with severity code INFO indicating that actually no error occured and the service was executed normally.
Returns an error code: Setting input data under a non-existing name, or asking for a result using an unknown name
Returns an error code: Input data are invalid; they do not match with their definitions, or with their dependency conditions
Returns an error code: Used when a client tries to send input data to a job created in a previous call but the server does not any more accept input data.
Returns an error code: Service requires a parameter but none was given
Returns an error code: Given parameter is incorrect
Returns an error code: Given input of type Simple is incorrect
Returns an error code: Service requires two or more data inputs.
Returns an error code: Given input of type Collection is incorrect.
Returns an error code: Given an empty input data.
Returns an error code: Incorrect Namespace in the input object.
Returns an error code: The same job (analysis) has already been executed, or the data that had been set previously do not exist or are not accessible anymore.
Returns an error code: A job (analysis) has not yet been started. Note that this exception is not raised when the job has been already finished.
Returns an error code: For some reasons, a job (analysis) is not interruptible, but an attempt to do so was done.
Returns an error code: There are no metadata available for the executed service/analysis.
Returns an error code: Used when a service does not agree on using any of the proposed notification protocols
Returns an error code: A placeholder for all other errors not defined explicitly in the Biomoby API.
Returns an error code: A generic network failure.
Returns an error code: Used when a service call expects to find an existing state but failed.
Returns an error code: A requested method is not implemented.
Edward Kawas (edward.kawas [at] gmail [dot] com) Martin Senger (martin.senger [at] gmail [dot] com)
To install MOSES::MOBY, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MOSES::MOBY
CPAN shell
perl -MCPAN -e shell install MOSES::MOBY
For more information on module installation, please visit the detailed CPAN module installation guide.