LSSTApplications  19.0.0-14-gb0260a2+d60062ef16,20.0.0+1540ce6389,20.0.0+7c6b12c2f9,20.0.0+ae956f52c5,20.0.0+be870186d9,20.0.0+e2e26847c2,20.0.0-1-g10df615+7683e4f082,20.0.0-1-g253301a+7c6b12c2f9,20.0.0-1-g2b7511a+46a6078777,20.0.0-1-g3dda6ea+606b36f8c0,20.0.0-1-g4d801e7+901ee84527,20.0.0-1-g5b95a8c+a5fa15ec54,20.0.0-1-gb058bd0+46a6078777,20.0.0-1-gb88604f+acecce4127,20.0.0-1-gc96f8cb+61a4a056b1,20.0.0-1-gedffbd8+4f0e391d5e,20.0.0-10-g0891cd99+aadc987f3e,20.0.0-10-g9a20bd332+576ca7b471,20.0.0-17-gcdbda88+ed0d4927ab,20.0.0-2-g4dae9ad+61a4a056b1,20.0.0-2-g61b8584+85c46248f3,20.0.0-2-gb780d76+f45b7d88f4,20.0.0-2-gf072044+7c6b12c2f9,20.0.0-21-g9bbb7f7+61a4a056b1,20.0.0-22-gc512666+9eba1c4719,20.0.0-23-g8900aa8+68630f7098,20.0.0-3-g1653f94+85c46248f3,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g750bffe+e05f822de9,20.0.0-3-gbd60e8c+ff10c6d78d,20.0.0-32-g15a0e07c+ff1c9f120b,20.0.0-4-g97dc21a+68630f7098,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-6-g9a5b7a1+2c4171520d,20.0.0-61-g4de25fb+e4dd172200,20.0.0-7-gcda7bf1+85e953d7e4,w.2020.43
LSSTDataManagementBasePackage
parserexceptions.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
32 #ifndef LSST_PEX_POLICY_PARSER_EXCEPTIONS_H
33 #define LSST_PEX_POLICY_PARSER_EXCEPTIONS_H
34 
36 #include <sstream>
37 
38 namespace lsst {
39 namespace pex {
40 namespace policy {
41 
47 public:
52  : lsst::pex::exceptions::RuntimeError(POL_EARGS_UNTYPED,
53  "Unspecified parsing error encountered") {}
54 
60  : lsst::pex::exceptions::RuntimeError(POL_EARGS_UNTYPED, msg) {}
61 
69  ParserError(POL_EARGS_TYPED, const std::string& msg, int lineno)
70  : lsst::pex::exceptions::RuntimeError(POL_EARGS_UNTYPED, makeLocatedMessage(msg, lineno)) {}
71 
72  static std::string makeLocatedMessage(const std::string& msg, int lineno) {
74  out << "Policy Parsing Error:" << lineno << ": " << msg << std::ends;
75  return out.str();
76  }
77 
78  virtual char const* getType() const throw();
79  virtual lsst::pex::exceptions::Exception* clone() const;
80 };
81 
85 class EOFError : public ParserError {
86 public:
90  EOFError(POL_EARGS_TYPED) : ParserError(POL_EARGS_UNTYPED, "Unexpected end of Policy data stream") {}
91 
97 
105  : ParserError(POL_EARGS_UNTYPED, "Unexpected end of Policy data stream", lineno) {}
106 
114  EOFError(POL_EARGS_TYPED, const std::string& msg, int lineno)
115  : ParserError(POL_EARGS_UNTYPED, msg, lineno) {}
116 
117  virtual char const* getType() const throw();
118  virtual lsst::pex::exceptions::Exception* clone() const;
119 };
120 
124 class SyntaxError : public ParserError {
125 public:
130 
136 
144  SyntaxError(POL_EARGS_TYPED, const std::string& msg, int lineno)
145  : ParserError(POL_EARGS_UNTYPED, msg, lineno) {}
146 
147  virtual char const* getType() const throw();
148  virtual lsst::pex::exceptions::Exception* clone() const;
149 };
150 
156 public:
161 
167 
176  : SyntaxError(POL_EARGS_UNTYPED, msg, lineno) {}
177 
178  virtual char const* getType() const throw();
179  virtual lsst::pex::exceptions::Exception* clone() const;
180 };
181 
187 public:
192 
198 
207  : SyntaxError(POL_EARGS_UNTYPED, msg, lineno) {}
208 
209  virtual char const* getType() const throw();
210  virtual lsst::pex::exceptions::Exception* clone() const;
211 };
212 
213 } // namespace policy
214 } // namespace pex
215 } // namespace lsst
216 
217 #endif // LSST_PEX_POLICY_PARSER_EXCEPTIONS_H
lsst.pex::policy::EOFError::EOFError
EOFError(POL_EARGS_TYPED, const std::string &msg)
Create an exception the exception with a given message.
Definition: parserexceptions.h:96
std::string
STL class.
lsst.pex::policy::ParserError::ParserError
ParserError(POL_EARGS_TYPED, const std::string &msg)
Create an exception the exception with a given message.
Definition: parserexceptions.h:59
lsst.pex::policy::ParserError::clone
virtual lsst::pex::exceptions::Exception * clone() const
Return a copy of the exception as an Exception pointer.
lsst.pex::policy::EOFError::getType
virtual char const * getType() const
Return the fully-specified C++ type of a pointer to the exception.
lsst.pex::policy::EOFError
an exception indicated that the stream being parsed ended prematurely.
Definition: parserexceptions.h:85
lsst.pex::policy::SyntaxError::SyntaxError
SyntaxError(POL_EARGS_TYPED, const std::string &msg)
Create an exception the exception with a given message.
Definition: parserexceptions.h:135
lsst.pex::policy::ParserError::makeLocatedMessage
static std::string makeLocatedMessage(const std::string &msg, int lineno)
Definition: parserexceptions.h:72
std::ends
T ends(T... args)
lsst.pex::policy::UnsupportedSyntax::UnsupportedSyntax
UnsupportedSyntax(POL_EARGS_TYPED, const std::string &msg)
Create an exception the exception with a given message.
Definition: parserexceptions.h:197
lsst.pex::policy::SyntaxError::SyntaxError
SyntaxError(POL_EARGS_TYPED, const std::string &msg, int lineno)
Create an exception the exception with a given message.
Definition: parserexceptions.h:144
lsst.pex::policy::EOFError::EOFError
EOFError(POL_EARGS_TYPED)
Create an exception the exception with a default message.
Definition: parserexceptions.h:90
lsst.pex::policy::FormatSyntaxError
an exception thrown because a syntax error specific to the format being parsed was encountered.
Definition: parserexceptions.h:155
lsst.pex::policy::FormatSyntaxError::FormatSyntaxError
FormatSyntaxError(POL_EARGS_TYPED, const std::string &msg)
Create an exception the exception with a given message.
Definition: parserexceptions.h:166
lsst.pex::policy::UnsupportedSyntax::UnsupportedSyntax
UnsupportedSyntax(POL_EARGS_TYPED, const std::string &msg, int lineno)
Create an exception the exception with a given message.
Definition: parserexceptions.h:206
POL_EARGS_UNTYPED
#define POL_EARGS_UNTYPED
Definition: exceptions.h:39
lsst.pex::policy::SyntaxError::SyntaxError
SyntaxError(POL_EARGS_TYPED)
Create an exception the exception with a default message.
Definition: parserexceptions.h:129
lsst.pex::policy::EOFError::EOFError
EOFError(POL_EARGS_TYPED, const std::string &msg, int lineno)
Create an exception the exception with a given message.
Definition: parserexceptions.h:114
lsst.pex::policy::SyntaxError::getType
virtual char const * getType() const
Return the fully-specified C++ type of a pointer to the exception.
POL_EARGS_TYPED
#define POL_EARGS_TYPED
Definition: exceptions.h:38
lsst.pex::policy::EOFError::EOFError
EOFError(POL_EARGS_TYPED, int lineno)
Create an exception the exception with a default message.
Definition: parserexceptions.h:104
lsst.pex::policy::ParserError::getType
virtual char const * getType() const
Return the fully-specified C++ type of a pointer to the exception.
exceptions.h
definition of Policy-specific exceptions classes
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
std::ostringstream
STL class.
lsst.pex::policy::ParserError
an parent exception for errors that occur during the parsing of policy files.
Definition: parserexceptions.h:46
lsst.pex::policy::UnsupportedSyntax::getType
virtual char const * getType() const
Return the fully-specified C++ type of a pointer to the exception.
lsst.pex::policy::SyntaxError
an exception thrown because a general syntax error was encountered.
Definition: parserexceptions.h:124
lsst.pex::policy::ParserError::ParserError
ParserError(POL_EARGS_TYPED)
Create an exception the exception with a default message.
Definition: parserexceptions.h:51
lsst.pex::policy::UnsupportedSyntax::UnsupportedSyntax
UnsupportedSyntax(POL_EARGS_TYPED)
Create an exception the exception with a default message.
Definition: parserexceptions.h:191
lsst.pex::policy::UnsupportedSyntax
an exception thrown because syntax was encountered that is legal for the format being parsed but whic...
Definition: parserexceptions.h:186
lsst.pex::policy::ParserError::ParserError
ParserError(POL_EARGS_TYPED, const std::string &msg, int lineno)
Create an exception the exception with a given message.
Definition: parserexceptions.h:69
std::ostringstream::str
T str(T... args)
lsst.pex::policy::FormatSyntaxError::getType
virtual char const * getType() const
Return the fully-specified C++ type of a pointer to the exception.
lsst.pex::policy::FormatSyntaxError::FormatSyntaxError
FormatSyntaxError(POL_EARGS_TYPED)
Create an exception the exception with a default message.
Definition: parserexceptions.h:160
lsst.pex::exceptions::Exception::Exception
Exception(char const *file, int line, char const *func, std::string const &message)
Standard constructor, intended for C++ use via the LSST_EXCEPT() macro.
Definition: Exception.cc:42
lsst.pex::exceptions::RuntimeError
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104
lsst.pex::policy::FormatSyntaxError::FormatSyntaxError
FormatSyntaxError(POL_EARGS_TYPED, const std::string &msg, int lineno)
Create an exception the exception with a given message.
Definition: parserexceptions.h:175