next up previous
Next: Appendix: Examples Up: MeasurementSet Selection Syntax Previous: Scan/Sub-array Selection

Appendix: General Error Handling

The MSSelection sub-system reports errors via the C++ exception mechanism. The objects thrown have the following inheritance hierarchy:

                             AipsError
                                 o
                                 |
                                 |
                          MSSelectionError
                                 o
                                 |
                                 |
  MSSelection{Time,Spw,UvDist,Antenna,Scan,Subarray,Poln,State}Error
                                 o
                                 |
                                 |
MSSelection{Time,Spw,UvDist,Antenna,Scan,Subarray,Poln,State}ParseError

All parsing errors are reported by throwing the MSSelection{Time, Spw, Field, UvDist, Antenna, Scan, Subarray,Poln,State}ParseError exception. All other forms of errors (e.g. illegal range specification N0$ \sim$ N1 where N0 $ >$ N1) are reported by throwing an exception of type MSSelection{Time, Spw, Field, UvDist, Antenna, Scan, Subarray,Poln,State}Error.

Hence, to catch all errors thrown from the MSSelection sub-system, catch the MSSelectionError object. For more specific exception handling, catch the more qualified MSSelection*Error objects. For catching only parsing errors, catch the MSSelection*ParseError object. As is obvious, any un-caught exception from the MSSelection sub-system will be caught in the AipsError catch block.

The exceptional error message consists of a human understandable one-line description of the error, the string which caused the error and the possible location in the string of the erroneous character. E.g.

Spw Expression: No match found for "LBAN" (near char. 4 in string "LBAN")



Sanjay Bhatnagar 2011-02-23