-
-
Notifications
You must be signed in to change notification settings - Fork 12
Improve compiler and linter error classes #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,12 +34,17 @@ class SOURCEMETA_BLAZE_LINTER_EXPORT LinterMissingNameError | |
| class SOURCEMETA_BLAZE_LINTER_EXPORT LinterInvalidNameError | ||
| : public std::exception { | ||
| public: | ||
| LinterInvalidNameError(const std::string_view identifier, | ||
| const std::string_view message) | ||
| LinterInvalidNameError(const std::string_view identifier, const char *message) | ||
| : identifier_{identifier}, message_{message} {} | ||
| LinterInvalidNameError(const std::string_view identifier, | ||
| std::string message) = delete; | ||
| LinterInvalidNameError(const std::string_view identifier, | ||
| std::string &&message) = delete; | ||
| LinterInvalidNameError(const std::string_view identifier, | ||
| std::string_view message) = delete; | ||
|
|
||
| [[nodiscard]] auto what() const noexcept -> const char * override { | ||
| return this->message_.c_str(); | ||
| return this->message_; | ||
| } | ||
|
|
||
| [[nodiscard]] auto identifier() const noexcept -> const std::string & { | ||
|
|
@@ -48,7 +53,34 @@ class SOURCEMETA_BLAZE_LINTER_EXPORT LinterInvalidNameError | |
|
|
||
| private: | ||
| std::string identifier_; | ||
| std::string message_; | ||
| const char *message_; | ||
jviotti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| /// @ingroup linter | ||
| /// An error that represents a schema rule name that does not match | ||
| /// the required pattern | ||
| class SOURCEMETA_BLAZE_LINTER_EXPORT LinterInvalidNamePatternError | ||
| : public std::exception { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Severity: medium Other Locations
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| public: | ||
| LinterInvalidNamePatternError(const std::string_view identifier, | ||
| const std::string_view regex) | ||
| : identifier_{identifier}, regex_{regex} {} | ||
|
|
||
| [[nodiscard]] auto what() const noexcept -> const char * override { | ||
| return "The schema rule name does not match the required pattern"; | ||
| } | ||
|
|
||
| [[nodiscard]] auto identifier() const noexcept -> const std::string & { | ||
| return this->identifier_; | ||
| } | ||
|
|
||
| [[nodiscard]] auto regex() const noexcept -> const std::string & { | ||
| return this->regex_; | ||
| } | ||
|
|
||
| private: | ||
| std::string identifier_; | ||
| std::string regex_; | ||
| }; | ||
|
|
||
| #if defined(_MSC_VER) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.