Loading...
Searching...
No Matches
io/exception.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <ios>
#include <stdexcept>
#include <seqan3/core/platform.hpp>
namespace seqan3
{
// ----------------------------------------------------------------------------
// file open exceptions
// ----------------------------------------------------------------------------
struct unhandled_extension_error : std::invalid_argument
{
unhandled_extension_error(std::string const & s) : std::invalid_argument{s}
{}
};
struct file_open_error : std::runtime_error
{
file_open_error(std::string const & s) : std::runtime_error{s}
{}
};
struct parse_error : std::runtime_error
{
parse_error(std::string const & s) : std::runtime_error{s}
{}
};
struct io_error : std::ios_base::failure
{
#if SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
// std::ios_base::failure is missing the std::error_code constructor in pre-C++11 ABI
// see https://en.cppreference.com/w/cpp/io/ios_base/failure
using base_t = std::ios_base::failure;
using base_t::base_t;
#else // ^^^ workaround / no workaround vvv
explicit io_error(std::string const & s, std::error_code const & ec = std::io_errc::stream) :
std::ios_base::failure{s, ec}
{}
#endif // SEQAN3_WORKAROUND_GCC_NO_CXX11_ABI
};
// ----------------------------------------------------------------------------
// parse exceptions
// ----------------------------------------------------------------------------
struct unexpected_end_of_input : std::runtime_error
{
unexpected_end_of_input(std::string const & s) : std::runtime_error{s}
{}
};
// ----------------------------------------------------------------------------
// write exceptions
// ----------------------------------------------------------------------------
struct format_error : std::invalid_argument
{
format_error(std::string const & s) : std::invalid_argument{s}
{}
};
} // namespace seqan3
std::string
std::ios_base::failure
std::invalid_argument
ios
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
std
SeqAn specific customisations in the standard namespace.
platform.hpp
Provides platform and dependency checks.
std::runtime_error
stdexcept
seqan3::file_open_error::file_open_error
file_open_error(std::string const &s)
Constructor that forwards the exception string.
Definition io/exception.hpp:38
seqan3::format_error::format_error
format_error(std::string const &s)
Constructor that forwards the exception string.
Definition io/exception.hpp:90
seqan3::io_error::io_error
io_error(std::string const &s, std::error_code const &ec=std::io_errc::stream)
Constructor that forwards the exception string.
Definition io/exception.hpp:62
seqan3::parse_error::parse_error
parse_error(std::string const &s)
Constructor that forwards the exception string.
Definition io/exception.hpp:47
seqan3::unexpected_end_of_input::unexpected_end_of_input
unexpected_end_of_input(std::string const &s)
Constructor that forwards the exception string.
Definition io/exception.hpp:77
seqan3::unhandled_extension_error::unhandled_extension_error
unhandled_extension_error(std::string const &s)
Constructor that forwards the exception string.
Definition io/exception.hpp:29
Hide me