NAME

MOBY::Client::Exception::MobyException - MobyException


DESCRIPTION

Class that contains exception instance and exception methods


AUTHORS

Jose Manuel Rodriguez Carrasco -jmrodriguez@cnio.es- (INB-CNIO)


METHODS

new

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',
                                                                                                ));
                };

getExceptionCode

Function: Return exception code.

Args: <empty>

Returns:
- Integer: Exception Code.

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',
                                                                                                ));
                };
                if ($@) {
                        if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception
                                print "Code: ".$exception->getExceptionCode()."\n";
                        }
                }

getExceptionMessage

Function: Return exception message.

Args: <empty>

Returns:
- String: Exception message.

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',
                                                                                                ));
                };
                if ($@) {
                        if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception
                                print "Message: ".$exception->getExceptionMessage()."\n";
                        }
                }

getExceptionType

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 = 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";
                        }
                }

setExceptionCode

Function: Assign exception code.

Args:
- Integer: Exception Code.

Returns: <empty>

Usage:

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

setExceptionMessage

Function: Assign exception message.

Args:
- String: Exception message.

Returns: <empty>

Usage:

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

setExceptionType

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 = MOBY::Client::Exception::MobyException->new());
                };
                if ($@) {
                        if ($exception->isa('MOBY::Client::Exception::MobyException')) { # Moby Exception
                                # Add new attribute
                                $exception->setExceptionType("error");
                        }
                }

retrieveExceptionResponse

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 = 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";
                        }
                }

retrieveEmptyMobyData

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 = 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";
                        }
                }

retrieveEmptyMobySimple

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 = 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');
                        }
                }

retrieveEmptyMobyCollection

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 = 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');
                        }
                }

embedMOBYArticlesIntoMOBYData

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

embedExceptionsIntoServiceNotes

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

retrieveEmptyMobyStatus

Function: Return xml block of one empty MobyStatus.

Args: <empty>

Returns:
- xml block of one empty MobyStatus:

                <moby:mobyStatus moby:queryID='queryID' />