MobyException
Class that contains exception instance and exception methods
Jose Manuel Rodriguez Carrasco -jmrc@cnb.uam.es- (INB-CNB)
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 Instace.
Usage : my ($exception); eval { system("Your application") || die ($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.
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception print "Code: ".$exception->getExceptionCode()."\n"; } }
Function : Return exception message.
Args : <empty>
Returns : - String: Exception message.
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception print "Message: ".$exception->getExceptionMessage()."\n"; } }
Function : Return type of exception.
Args : <empty>
Returns : - String (error, information, warning): Exception type of exception.
Usage : my ($exception); eval { system("Your a$exceptionpplication") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception print "Type: ".$exception->getExceptionType()."\n"; } }
Function : Assign exception code.
Args : - Integer: Exception Code.
Returns : <empty>
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new()); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception # Add new attribute $exception->setExceptionCode(200); } }
Function : Assign exception message.
Args : - String: Exception message.
Returns : <empty>
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new()); }; if ($@) { if ($exception->isa('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.
Returns : <empty>
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new()); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception # Add new attribute $exception->setExceptionType("error"); } }
Function : Return xml block that will be the exception response (error, warning or information).
Args : <empty>
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>
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception print "Exception Response: ".$exception->retrieveExceptionResponse()."\n"; } }
Function : Return xml block of one empty MobyData.
Args : <empty>
Returns : - xml block of one empty MobyData:
<moby:mobyData moby:queryID='queryID' />
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('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' />
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('MobyException')) { # Moby Exception my ($emptyMobyResponse) = $exception->retrieveEmptyMobySimple('outputArticle'); } }
Function : Return xml block of one empty collection MobyArticle.
Args : - String: name of output article.
Returns : - xml block of one empty collection MobyArticle:
<moby:Collection moby:articleName='outputArticle' />
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('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>
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('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>
Usage : my ($exception); eval { system("Your application") || die ($exception = MobyException->new( code => 200, queryID => 1, refElement => 'test', message => 'Add new description', type => 'error', )); }; if ($@) { if ($exception->isa('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.
Args : <empty>
Returns : - xml block of one empty MobyStatus:
<moby:mobyStatus moby:queryID='queryID' />