mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
エラー通知を標準例外に変更
This commit is contained in:
parent
9823888049
commit
4729d31bf2
22 changed files with 76 additions and 57 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/string.hpp>
|
||||
#include <sprout/uuid/uuid.hpp>
|
||||
|
@ -30,7 +31,10 @@ namespace sprout {
|
|||
Iterator last;
|
||||
public:
|
||||
SPROUT_CONSTEXPR next_char(Iterator f, Iterator l)
|
||||
: c(f != l ? *f : throw "string_generator: invalid uuid string (out of range)")
|
||||
: c(f != l
|
||||
? *f
|
||||
: throw std::domain_error("string_generator: invalid uuid string (out of range)")
|
||||
)
|
||||
, first(sprout::next(f))
|
||||
, last(l)
|
||||
{}
|
||||
|
@ -42,7 +46,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR std::uint8_t value_at(std::size_t i) const {
|
||||
return i < 22
|
||||
? sprout::uuids::detail::values<void>::table[i]
|
||||
: throw "string_generator: invalid uuid string (invalid character)"
|
||||
: throw std::domain_error("string_generator: invalid uuid string (invalid character)")
|
||||
;
|
||||
}
|
||||
template<typename Elem>
|
||||
|
@ -110,7 +114,7 @@ namespace sprout {
|
|||
return has_dashes
|
||||
? is_dash(nc.c)
|
||||
? generate_2_2(nc.next(), open_brace, has_dashes, args...)
|
||||
//: throw "string_generator: invalid uuid string (dashes not found)" // ???
|
||||
//: throw std::domain_error("string_generator: invalid uuid string (dashes not found)") // ???
|
||||
: generate_2_2(nc, open_brace, has_dashes, args...)
|
||||
: generate_2_2(nc, open_brace, has_dashes, args...)
|
||||
;
|
||||
|
@ -139,7 +143,7 @@ namespace sprout {
|
|||
>::type generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
return !open_brace || (open_brace && is_close_brace(nc.next().c, open_brace))
|
||||
? result_type{{args...}}
|
||||
: throw "string_generator: invalid uuid string (brace not closed)"
|
||||
: throw std::domain_error("string_generator: invalid uuid string (brace not closed)")
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue