00001 //# <MirExceptions.h>: this defines exception classes associated with filling errors 00002 //# Copyright (C) 2000,2001,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: MirExceptions.h,v 1.1 2009/09/03 18:54:47 pteuben Exp $ 00028 00029 #ifndef BIMA_MIREXCEPTIONS_H 00030 #define BIMA_MIREXCEPTIONS_H 00031 00032 #include <casa/Exceptions/Error.h> 00033 00034 #include <casa/namespace.h> 00035 //# Forward Declarations 00036 00037 //# UnavailableMiriadDataSelectionError 00038 // <summary> 00039 // an exception indicating that a requested data selection from a Miriad 00040 // dataset is not available. 00041 // </summary> 00042 // 00043 // <use visibility=export> 00044 // 00045 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00046 // </reviewed> 00047 // 00048 // <synopsis> 00049 // This class can be thrown as an exception to indicate that a requested 00050 // data selection from a Miriad dataset is not available, usually because 00051 // the selection is out of the bounds of the dataset's contents. 00052 // </synopsis> 00053 // 00054 // <example> 00055 // <srcblock> 00056 // if (win > maxwin || win <= 0) 00057 // throw UnavailableMiriadDataSelectionError("No such window", win); 00058 // } 00059 // </srcblock> 00060 // </example> 00061 // 00062 // <motivation> 00063 // Users can potentially make illegal data selection requests. 00064 // </motivation> 00065 // 00066 class UnavailableMiriadDataSelectionError : public AipsError { 00067 public: 00068 00069 // An exception with a message. win usually is a window number. 00070 UnavailableMiriadDataSelectionError(const String& msg, Int win=0); 00071 00072 // An exception with a message. sel is the data selection value (e.g. 00073 // requested source name). 00074 UnavailableMiriadDataSelectionError(const String& msg, const String& sel); 00075 00076 virtual ~UnavailableMiriadDataSelectionError() throw(); 00077 00078 protected: 00079 // Message-less exceptions should not be created excepted possibly by 00080 // subclasses 00081 UnavailableMiriadDataSelectionError(); 00082 00083 // format a message from a string and the illegal integer selection. 00084 // This class is used as a convenience for the instantiating the 00085 // parent class, AipsError, which can only take a simple String. 00086 static String makeMsg(const String& msg, Int selval=0); 00087 }; 00088 00089 //# MiriadFormatError 00090 // <summary> 00091 // an exception indicating that a non-recoverable format error was detected 00092 // in the input Miriad dataset 00093 // </summary> 00094 // 00095 // <use visibility=export> 00096 // 00097 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00098 // </reviewed> 00099 // 00100 // <synopsis> 00101 // This exception can be thrown when a Miriad dataset contains some unexpected 00102 // and/or illegal structures. This may happen if the dataset is corrupted or 00103 // otherwise does not conform to the legal format specification. 00104 // </synopsis> 00105 // 00106 // <example> 00107 // <srcblock> 00108 // uvprobvr_c(mirds_handle, "sfreq", vtype, &vlen, &vupd); 00109 // if (vlen != nspect) { 00110 // throw MiriadFormatError(String("Wrong number of values for variable ") + 00111 // "sfreq: got " + vlen + "; expected " + nspect); 00112 // } 00113 // </srcblock> 00114 // </example> 00115 // 00116 // <motivation> 00117 // This class handles the possibility that a non-conforming or corrupted 00118 // Miriad dataset is encountered. 00119 // </motivation> 00120 // 00121 class MiriadFormatError : public AipsError { 00122 public: 00123 // create the exception with a message describing the format error 00124 MiriadFormatError(const String &msg); 00125 00126 virtual ~MiriadFormatError() throw(); 00127 00128 protected: 00129 // Message-less exceptions should not be created excepted possibly by 00130 // subclasses 00131 MiriadFormatError(); 00132 }; 00133 00134 00135 //# MiriadUnsupportedFeatureError 00136 // <summary> 00137 // an exception indicating that further processing is dependent on an 00138 // unsupported feature of a Miriad dataset 00139 // </summary> 00140 00141 // <use visibility=export> 00142 00143 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00144 // </reviewed> 00145 00146 // <etymology> 00147 // Not all features of a Miriad dataset are necessarily supported by the filler 00148 // classes. 00149 // </etymology> 00150 // 00151 // <synopsis> 00152 // This exception can be thrown during the processing of a Miriad dataset when 00153 // an unsupported feature is encountered. For example, early versions of the 00154 // Miriad filler do not support multiple polarizations, although future 00155 // support is expected. When multiple polarizations are found in the dataset, 00156 // this class is thrown as an exception. 00157 // </synopsis> 00158 // 00159 // <example> 00160 // <srcblock> 00161 // if (! supported(feature)) { 00162 // throw MiriadUnsupportedFeatureError(String("Feature ") + feature.name() 00163 // + " not yet supported"); 00164 // } 00165 // </srcblock> 00166 // </example> 00167 // 00168 // <motivation> 00169 // This class allows features of a Miriad dataset to be supported incrementally 00170 // with new versions of the filler classes. 00171 // </motivation> 00172 // 00173 class MiriadUnsupportedFeatureError : public AipsError { 00174 public: 00175 00176 // An exception with a message indicating the unsupported feature 00177 MiriadUnsupportedFeatureError(const String &msg); 00178 00179 virtual ~MiriadUnsupportedFeatureError() throw(); 00180 00181 protected: 00182 // Message-less exceptions should not be created excepted possibly by 00183 // subclasses 00184 MiriadUnsupportedFeatureError(); 00185 }; 00186 00187 00188 #endif 00189 00190