MOBY::Client::Exception::MobyException - MobyException
Class that contains exception instance and exception methods
Jose Manuel Rodriguez Carrasco -jmrodriguez@cnio.es- (INB-CNIO)
Function: Create new instance of exception class.
Args: - querID from one MobyData assign to exception. - refElement, reference to articleName. - Exception Code. - Exception Message. - Type of exception: error, information, or warning.
Returns: - Exception Instance.
Usage:
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); };
Function: Return exception code.
Args: <empty>
Returns: - Integer: Exception Code.
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception print "Code: ".$exception->getExceptionCode()."\n"; } }
Function: Return exception message.
Returns: - String: Exception message.
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception print "Message: ".$exception->getExceptionMessage()."\n"; } }
Function: Return type of exception.
Returns: - String (error, information, warning): Exception type of exception.
my ($exception); eval { system("Your a$exceptionpplication") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception print "Type: ".$exception->getExceptionType()."\n"; } }
Function: Assign exception code.
Args: - Integer: Exception Code.
Returns: <empty>
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new()); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception # Add new attribute $exception->setExceptionCode(200); } }
Function: Assign exception message.
Args: - String: Exception message.
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new()); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception # Add new attribute $exception->setExceptionMessage("Add new description"); } }
Function: Assign type of exception to attribute of class.
Args: - String (error, information, warning): type of exception.
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new()); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception # Add new attribute $exception->setExceptionType("error"); } }
Function: Return xml block that will be the exception response (error, warning or information).
Returns: - xml block of exception response. Example of 'error' block:
<mobyException refQueryID='queryID' refElement='refElement' severity='error'> <exceptionCode>code</exceptionCode> <exceptionMessage>error message + new description</exceptionMessage> </mobyException>
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception print "Exception Response: ".$exception->retrieveExceptionResponse()."\n"; } }
Function: Return xml block of one empty MobyData.
Returns: - xml block of one empty MobyData:
<moby:mobyData moby:queryID='queryID' />
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception print "Empty MobyData Response: ".$exception->retrieveEmptyMobyData()."\n"; } }
Function: Return xml block of one empty simple MobyArticle.
Args: - String: name of output article.
Returns: - xml block of one empty simple MobyArticle:
<moby:Simple moby:articleName='outputArticle' />
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception my ($emptyMobyResponse) = $exception->retrieveEmptyMobySimple('outputArticle'); } }
Function: Return xml block of one empty collection MobyArticle.
Returns: - xml block of one empty collection MobyArticle:
<moby:Collection moby:articleName='outputArticle' />
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception my ($emptyMobyResponse) = $exception->retrieveEmptyMobyCollection('outputArticle'); } }
Function: Return MobyData inserting MobyArticles that has been giving by input.
Args: - xml block which contains MobyArticles.
Returns: - xml block of MobyData:
<moby:mobyData moby:queryID='queryID'>output MOBYArticles</moby:mobyData>
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception my ($emptyMobyResponse) = $exception->retrieveEmptyMobyCollection('outputArticle'); print "Moby Response: ".$exception->embedMOBYArticlesIntoMOBYData($emptyMobyResponse); } }
Function: Return ServiceNotes tag inserting MobyExceptions that has been giving by input.
Args: - xml block which contains MobyExceptions.
Returns: - xml block of Service Notes:
<serviceNotes>$outputMOBYExceptions</serviceNotes>
my ($exception); eval { system("Your application") || die ($exception = MOBY::Client::Exception::MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception my ($emptyMobyResponse) = $exception->retrieveEmptyMobyCollection('outputArticle'); my ($exceptionMobyResponse) = $exception->embedMOBYArticlesIntoMOBYData($emptyMobyResponse); print "Service Notes: ".$exception->embedExceptionsIntoServiceNotes($exceptionMobyResponse); } }
Function: Return xml block of one empty MobyStatus.
Returns: - xml block of one empty MobyStatus:
<moby:mobyStatus moby:queryID='queryID' />
To install MOBY::CommonSubs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MOBY::CommonSubs
CPAN shell
perl -MCPAN -e shell install MOBY::CommonSubs
For more information on module installation, please visit the detailed CPAN module installation guide.