Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
semver_error.h
1#ifndef SOURCEMETA_CORE_SEMVER_ERROR_H_
2#define SOURCEMETA_CORE_SEMVER_ERROR_H_
3
4#ifndef SOURCEMETA_CORE_SEMVER_EXPORT
5#include <sourcemeta/core/semver_export.h>
6#endif
7
8#include <sourcemeta/core/error.h>
9
10#include <cstdint> // std::uint64_t
11
12namespace sourcemeta::core {
13
14SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
15
17class SOURCEMETA_CORE_SEMVER_EXPORT SemVerParseError : public Error {
18public:
20 SemVerParseError(const std::uint64_t column) noexcept
21 : Error{"The input is not a valid Semantic Version"}, column_{column} {}
22
24 [[nodiscard]] auto column() const noexcept -> std::uint64_t {
25 return this->column_;
26 }
27
28private:
29 std::uint64_t column_;
30};
31
33class SOURCEMETA_CORE_SEMVER_EXPORT SemVerOverflowError : public Error {
34public:
36 SemVerOverflowError(const std::uint64_t column) noexcept
37 : Error{"The numeric component of the Semantic Version overflows"},
38 column_{column} {}
39
41 [[nodiscard]] auto column() const noexcept -> std::uint64_t {
42 return this->column_;
43 }
44
45private:
46 std::uint64_t column_;
47};
48
49SOURCEMETA_CORE_ERROR_WARNINGS_POP
50
51} // namespace sourcemeta::core
52
53#endif
auto column() const noexcept -> std::uint64_t
The column at which the overflow occurred.
Definition semver_error.h:41
SemVerOverflowError(const std::uint64_t column) noexcept
Construct an error located at the given column of the input.
Definition semver_error.h:36
SemVerParseError(const std::uint64_t column) noexcept
Construct an error located at the given column of the input.
Definition semver_error.h:20
auto column() const noexcept -> std::uint64_t
The column at which the parsing failure occurred.
Definition semver_error.h:24
Error(const StaticString message) noexcept
Construct the error given its message.
Definition error_base.h:84