Commit bf608ab16d830ebf2ffe5e925909c5bf290afd70
1 parent
37119954
Extend rsp_invalid_type exception.
Add an optional message to the rsp_invalid_type exception.
Showing
2 changed files
with
12 additions
and
6 deletions
include/GException.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GException.hpp - exception handler * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2006-2011 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2006-2012 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | /** |
| 22 | 22 | * @file GException.hpp |
| 23 | 23 | * @brief Exception handler interface definiton. |
| 24 | - * @author J. Knoedlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | #ifndef GEXCEPTION_HPP |
| ... | ... | @@ -507,7 +507,8 @@ public: |
| 507 | 507 | }; |
| 508 | 508 | class rsp_invalid_type : public GExceptionHandler { |
| 509 | 509 | public: |
| 510 | - rsp_invalid_type(std::string origin, std::string type); | |
| 510 | + rsp_invalid_type(std::string origin, std::string type, | |
| 511 | + std::string message = ""); | |
| 511 | 512 | }; |
| 512 | 513 | class gti_invalid : public GExceptionHandler { |
| 513 | 514 | public: | ... | ... |
src/obs/GException_obs.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GException_obs.cpp - observations exception handlers * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2011 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2012 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | /** |
| 22 | 22 | * @file GException_obs.cpp |
| 23 | 23 | * @brief Observation exception handler interface implementation |
| 24 | - * @author J. Knoedlseder | |
| 24 | + * @author Juergen Knoedlseder | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | /* __ Includes ___________________________________________________________ */ |
| ... | ... | @@ -201,15 +201,20 @@ GException::caldb_not_found::caldb_not_found(std::string origin, |
| 201 | 201 | * |
| 202 | 202 | * @param[in] origin Method that throws the error. |
| 203 | 203 | * @param[in] type Specified response type. |
| 204 | + * @param[in] message Optional error message. | |
| 204 | 205 | ***************************************************************************/ |
| 205 | 206 | GException::rsp_invalid_type::rsp_invalid_type(std::string origin, |
| 206 | - std::string type) | |
| 207 | + std::string type, | |
| 208 | + std::string message) | |
| 207 | 209 | { |
| 208 | 210 | // Set method name |
| 209 | 211 | m_origin = origin; |
| 210 | 212 | |
| 211 | 213 | // Set error message |
| 212 | 214 | m_message = "Invalid response type \""+type+"\" specified."; |
| 215 | + if (message.length() > 0) { | |
| 216 | + m_message += " " + message; | |
| 217 | + } | |
| 213 | 218 | |
| 214 | 219 | // Return |
| 215 | 220 | return; | ... | ... |