NAME

MOSES::MOBY::ServiceException -

SYNOPSIS

 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);

 

DESCRIPTION

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.

ACCESSIBLE ATTRIBUTES

Details are in MOSES::MOBY::Base. Here just a list of them:

severity

An integer representing a severity code.

code

An integer representing an error code.

message

A texual message explaining this exception.

jobId

An identifier of a job that caused this exception.

dataName

An article name containing the offending data input.

SUBROUTINES

info

Create an instance of ServiceException that represents an info exception. An argument is a message text.

warning

Create an instance of ServiceException that represents an warning exception. An argument is a message text.

error

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.

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

extractExceptions

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).

Returned value is a reference to an array of MOSES::MOBY::ServiceExceptions. Return a reference to an empty array if there are no exceptions.

getSeverityAsString

Return the current severity level as text. Or an empty string if the severity code is unknown.

getErrorCodeAsString

Return a stringified form of the error code associated with this exception. Or an empty string if the error code is unknown.

CONSTANT SUBROUTINES

The following subroutines represents all error codes and similar constants, as defined by BioMoby API.

ERROR

Returns A severity code that corresponds to a fatal error

No arguments

WARNING

Returns a severity code that corresponds to an informative diagnostic message

No arguments

INFO

Returns a severity code that corresponds to a message not related to any error

No arguments

OK

Returns an error code: No error. Used together with severity code INFO indicating that actually no error occured and the service was executed normally.

No arguments

UNKNOWN_NAME

Returns an error code: Setting input data under a non-existing name, or asking for a result using an unknown name

No arguments

INPUTS_INVALID

Returns an error code: Input data are invalid; they do not match with their definitions, or with their dependency conditions

No arguments

INPUT_NOT_ACCEPTED

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.

No arguments

INPUT_REQUIRED_PARAMETER

Returns an error code: Service requires a parameter but none was given

No arguments

INPUT_INCORRECT_PARAMETER

Returns an error code: Given parameter is incorrect

No arguments

INPUT_INCORRECT_SIMPLE

Returns an error code: Given input of type Simple is incorrect

No arguments

INPUT_INCORRECT_PARAMETERS

Returns an error code: Service requires two or more data inputs.

No arguments

INPUT_INCORRECT_COLLECTION

Returns an error code: Given input of type Collection is incorrect.

No arguments

INPUT_EMPTY_OBJECT

Returns an error code: Given an empty input data.

No arguments

INPUT_INCORRECT_NAMESPACE

Returns an error code: Incorrect Namespace in the input object.

No arguments

NOT_RUNNABLE

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.

No arguments

NOT_RUNNING

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.

No arguments

NOT_TERMINATED

Returns an error code: For some reasons, a job (analysis) is not interruptible, but an attempt to do so was done.

No arguments

NO_METADATA_AVAILABLE

Returns an error code: There are no metadata available for the executed service/analysis.

No arguments

PROTOCOLS_UNACCEPTED

Returns an error code: Used when a service does not agree on using any of the proposed notification protocols

No arguments

INTERNAL_PROCESSING_ERROR

Returns an error code: A placeholder for all other errors not defined explicitly in the Biomoby API.

No arguments

COMMUNICATION_FAILURE

Returns an error code: A generic network failure.

No arguments

UNKNOWN_STATE

Returns an error code: Used when a service call expects to find an existing state but failed.

No arguments

NOT_IMPLEMENTED

Returns an error code: A requested method is not implemented.

No arguments

AUTHORS

Edward Kawas (edward.kawas [at] gmail [dot] com)
Martin Senger (martin.senger [at] gmail [dot] com)