SeqAn3
exceptions.hpp
Go to the documentation of this file.
1 // ============================================================================
2 // SeqAn - The Library for Sequence Analysis
3 // ============================================================================
4 //
5 // Copyright (c) 2006-2018, Knut Reinert & Freie Universitaet Berlin
6 // Copyright (c) 2016-2018, Knut Reinert & MPI Molekulare Genetik
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // * Neither the name of Knut Reinert or the FU Berlin nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
25 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 // DAMAGE.
32 //
33 // ============================================================================
34 
40 #pragma once
41 
42 #include <stdexcept>
43 
44 #include <seqan3/core/platform.hpp>
45 
46 namespace seqan3
47 {
48 
64 class parser_invalid_argument : public std::invalid_argument
65 {
66 public:
70  parser_invalid_argument(std::string const & s) : std::invalid_argument(s) {}
71 };
72 
75 {
76 public:
80  unknown_option(std::string const & s) : parser_invalid_argument(s) {}
81 };
82 
85 {
86 public:
90  too_many_arguments(std::string const & s) : parser_invalid_argument(s) {}
91 };
92 
95 {
96 public:
100  too_few_arguments(std::string const & s) : parser_invalid_argument(s) {}
101 };
102 
105 {
106 public:
110  required_option_missing(std::string const & s) : parser_invalid_argument(s) {}
111 };
112 
115 {
116 public:
121 };
122 
125 {
126 public:
130  type_conversion_failed(std::string const & s) : parser_invalid_argument(s) {}
131 };
132 
135 {
136 public:
141 };
142 
145 {
146 public:
150  validation_failed(std::string const & s) : parser_invalid_argument(s) {}
151 };
152 
163 class parser_design_error : public std::logic_error
164 {
165 public:
169  parser_design_error(std::string const & s) : std::logic_error(s) {}
170 };
171 
186 class parser_interruption : public std::exception
187 {
188 public:
190  char const * what()
191  {
192  return error.c_str();
193  }
194 
195 private:
197  std::string error{std::string("ATTENTION: The parser printed or exported the help page/interface information.") +
198  "This behaviour is expected but the exception should be caught by the developer through " +
199  "a try-catch block (see documentation) and the program correctly terminated."};
200 };
201 
202 } // namespace seqan3
Argument parser exception thrown when an argument could not be casted to the according type...
Definition: exceptions.hpp:144
Contains platform and dependency checks.
too_few_arguments(std::string const &s)
The constructor.
Definition: exceptions.hpp:100
unknown_option(std::string const &s)
The constructor.
Definition: exceptions.hpp:80
SeqAn specific customisations in the standard namespace.
Definition: align_result.hpp:221
type_conversion_failed(std::string const &s)
The constructor.
Definition: exceptions.hpp:130
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
Argument parser exception that is thrown whenever there is an design error directed at the developer ...
Definition: exceptions.hpp:163
Argument parser exception thrown when an argument could not be casted to the according type...
Definition: exceptions.hpp:124
parser_invalid_argument(std::string const &s)
The constructor.
Definition: exceptions.hpp:70
Argument parser exception thrown when too few arguments are provided.
Definition: exceptions.hpp:94
Argument parser exception thrown when an argument could not be casted to the according type...
Definition: exceptions.hpp:134
parser_design_error(std::string const &s)
The constructor.
Definition: exceptions.hpp:169
Argument parser exception thrown when too many arguments are provided.
Definition: exceptions.hpp:84
Argument parser exception thrown when a non-list option is declared multiple times.
Definition: exceptions.hpp:114
char const * what()
Returns the error message.
Definition: exceptions.hpp:190
Argument parser exception thrown when encountering unknown option.
Definition: exceptions.hpp:74
Argument parser exception that is thrown whenever there is an error while parsing the command line ar...
Definition: exceptions.hpp:64
overflow_error_on_conversion(std::string const &s)
The constructor.
Definition: exceptions.hpp:140
This exception is not an error but expected behavior that shall terminate the program (e...
Definition: exceptions.hpp:186
option_declared_multiple_times(std::string const &s)
The constructor.
Definition: exceptions.hpp:120
too_many_arguments(std::string const &s)
The constructor.
Definition: exceptions.hpp:90
validation_failed(std::string const &s)
The constructor.
Definition: exceptions.hpp:150
required_option_missing(std::string const &s)
The constructor.
Definition: exceptions.hpp:110
Argument parser exception thrown when a required option is missing.
Definition: exceptions.hpp:104