/* * Copyright (C) 2019-present ScyllaDB */ /* * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 */ #pragma once #include #include #include "seastarx.hh" namespace exception_predicate { /// Makes an exception predicate that applies \p check function to verify the exception and \p err /// function to create an error message if the check fails. extern std::function make( std::function check, std::function err); /// Returns a predicate that will check if the exception message contains the given fragment. extern std::function message_contains( const sstring& fragment, const std::source_location& loc = std::source_location::current()); /// Returns a predicate that will check if the exception message equals the given text. extern std::function message_equals( const sstring& text, const std::source_location& loc = std::source_location::current()); /// Returns a predicate that will check if the exception message matches the given regular expression. extern std::function message_matches( const std::string& regex, const std::source_location& loc = std::source_location::current()); } // namespace exception_predicate