SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
exception.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <ios>
16 #include <stdexcept>
17 
18 #include <seqan3/core/platform.hpp>
19 
20 namespace seqan3
21 {
22 
26 // ----------------------------------------------------------------------------
27 // file open exceptions
28 // ----------------------------------------------------------------------------
29 
31 struct unhandled_extension_error : std::invalid_argument
32 {
34  unhandled_extension_error(std::string const & s) : std::invalid_argument{s}
35  {}
36 };
37 
39 struct file_open_error : std::runtime_error
40 {
42  file_open_error(std::string const & s) : std::runtime_error{s}
43  {}
44 };
45 
47 struct parse_error : std::runtime_error
48 {
50  parse_error(std::string const & s) : std::runtime_error{s}
51  {}
52 };
53 
55 struct io_error : std::ios_base::failure
56 {
58  io_error(std::string const & s,
59  std::error_code const & ec) : std::ios_base::failure{s, ec}
60  {}
61 
63  explicit io_error(std::string const & s) : io_error{s, std::error_code{std::io_errc::stream}}
64  {}
65 };
66 
67 // ----------------------------------------------------------------------------
68 // parse exceptions
69 // ----------------------------------------------------------------------------
70 
72 struct unexpected_end_of_input : std::runtime_error
73 {
75  unexpected_end_of_input(std::string const & s) : std::runtime_error{s}
76  {}
77 };
78 
79 // ----------------------------------------------------------------------------
80 // write exceptions
81 // ----------------------------------------------------------------------------
82 
84 struct format_error : std::invalid_argument
85 {
87  format_error(std::string const & s) : std::invalid_argument{s}
88  {}
89 };
90 
92 
93 } // namespace seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Definition: affine_cell_proxy.hpp:154
Provides platform and dependency checks.
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem.
Definition: exception.hpp:40
file_open_error(std::string const &s)
Constructor that forwards the exception string.
Definition: exception.hpp:42
Thrown if information given to output format didn't match expectations.
Definition: exception.hpp:85
format_error(std::string const &s)
Constructor that forwards the exception string.
Definition: exception.hpp:87
Thrown if there is an io error in low level io operations such as in std::basic_streambuf operations.
Definition: exception.hpp:56
io_error(std::string const &s)
Constructor that forwards the exception string.
Definition: exception.hpp:63
io_error(std::string const &s, std::error_code const &ec)
Constructor that forwards the exception string.
Definition: exception.hpp:58
Thrown if there is a parse error, such as reading an unexpected character from an input stream.
Definition: exception.hpp:48
parse_error(std::string const &s)
Constructor that forwards the exception string.
Definition: exception.hpp:50
Thrown if I/O was expecting more input (e.g. a delimiter or a new line), but the end of input was rea...
Definition: exception.hpp:73
unexpected_end_of_input(std::string const &s)
Constructor that forwards the exception string.
Definition: exception.hpp:75
Thrown if there is no format that accepts a given file extension.
Definition: exception.hpp:32
unhandled_extension_error(std::string const &s)
Constructor that forwards the exception string.
Definition: exception.hpp:34