Matrix Science header

Error Handling
[Mascot results file module]

Error handling in ms_mascotresfile

All errors from all classes in the Mascot results file module are accumulated into a list in the ms_mascotresfile object, even if the error occurs in a related object. The errors are accumulated in the ms_mascotresfile object that was given as the parameter to the other object constructor. For example, when you create a new ms_peptidesummary object, errors are accessed through the ms_mascotresfile object, not the ms_peptidesummary object:

C++
    ms_mascotresfile *resfile = new ms_mascotresfile(filename);

    if (!resfile->isValid()) {
        /* Handle errors... */
    }

    resfile->clearAllErrors();

    ms_peptidesummary *pepsum = new ms_peptidesummary(resfile);

    if (!resfile->isValid()) { // resfile now contains errors from ms_peptidesummary
        /* Handle errors... */
    }

Perl
    my $resfile = new msparser::ms_mascotresfile($filename);

    if (not $resfile->isValid()) {
        # Handle errors...
    }

    $resfile->clearAllErrors();

    my $pepsum = new msparser::ms_peptidesummary($resfile);

    if (not $resfile->isValid()) { # resfile now contains errors from ms_peptidesummary
        /* Handle errors... */
    }

Java and C#
    ms_mascotresfile resfile = new ms_mascotresfile(filename);

    if (!resfile.isValid()) {
        /* Handle errors... */
    }

    resfile.clearAllErrors();

    ms_peptidesummary pepsum = new ms_peptidesummary(resfile);

    if (!resfile.isValid()) { // resfile now contains errors from ms_peptidesummary
        /* Handle errors... */
    }

Python
    resfile = msparser.ms_mascotresfile(filename)

    if not resfile.isValid():
        # Handle errors...

    resfile.clearAllErrors()

    pepsum = ms_peptidesummary(resfile)

    if not resfile.isValid(): # resfile now contains errors from ms_peptidesummary
        # Handle errors...

The list of errors is only ever cleared by calling clearAllErrors().

To determine the number of errors, call getNumberOfErrors(). To access a particular error by its number, call getErrorNumber(i), where i is a number between 1 and getNumberOfErrors(), inclusive. To get the error string for the same error, use getErrorString(i).

Multiple similar errors are grouped together. For, example, suppose that creating a peptide summary gave 3000 errors for null accession strings (and no other errors). getNumberOfErrors() then would return 2, but the second error would have the following error message:

Null accession number found for query x, rank y in peptides section. (Error repeated 2999 times)

Errors are classified as 'fatal' or 'warning'. The function isValid() will return true if there are just warnings, and false if there are any fatal errors.

Example code:

C++resfile_error.cpp
Perlresfile_error.pl
Javaresfile_error.java
Pythonresfile_error.py
C#resfile_error.cs

For a list of error return values, see ms_mascotresfile::err.

Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51