Skip to content
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

Support for regex exception #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions kaitai/exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ class validation_not_any_of_error: public validation_failed_error {
const T& m_actual;
};

/**
* Signals validation failure: we required "actual" value to match
* the regex, but it turned out that it's not.
*/
template<typename T>
class validation_regex_match_error: public validation_failed_error {
public:
validation_regex_match_error<T>(const T& regex, const T& actual, const kstream* io, const std::string src_path):
validation_failed_error("no regex match", io, src_path),
m_actual(actual)
{
}

// "not any of the list, got #{actual.inspect}"

virtual ~validation_regex_match_error<T>() KS_NOEXCEPT {};

protected:
const T& m_actual;
};

}

#endif