SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
exception.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, 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 <seqan3/std/concepts>
16 #include <stdexcept>
17 #include <string>
18 
20 
21 namespace seqan3
22 {
23 
30 {
35  invalid_char_assignment(std::string const & type_name, std::string const & wrong_char) :
36  std::runtime_error{std::string{"Assigning "} + wrong_char + " to an alphabet of type " +
37  type_name + " would incur information loss. If you want implicit conversion, use "
38  "seqan3::assign_char instead of seqan3::assign_char_strict."}
39  {}
40 
45  invalid_char_assignment(std::string const & type_name, char const wrong_char) :
46  invalid_char_assignment{type_name, detail::make_printable(wrong_char)}
47  {}
48 
53  template <std::convertible_to<char> char_t>
54  invalid_char_assignment(std::string const & type_name, char_t const wrong_char) :
55  invalid_char_assignment{type_name, static_cast<char>(wrong_char)}
56  {}
57 };
58 
59 } // namespace seqan3
The Concepts library.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
An exception typically thrown by seqan3::alphabet::assign_char_strict.
Definition: exception.hpp:30
invalid_char_assignment(std::string const &type_name, char const wrong_char)
Definition: exception.hpp:45
invalid_char_assignment(std::string const &type_name, char_t const wrong_char)
Definition: exception.hpp:54
invalid_char_assignment(std::string const &type_name, std::string const &wrong_char)
Constructor that takes the type name and the failed character as arguments.
Definition: exception.hpp:35
Provides seqan3::detail::make_printable which converts non printable characters (e....