Instead of lengthy blurbs, switch to single-line, machine-readable standardized (https://spdx.dev) license identifiers. The Linux kernel switched long ago, so there is strong precedent. Three cases are handled: AGPL-only, Apache-only, and dual licensed. For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0), reasoning that our changes are extensive enough to apply our license. The changes we applied mechanically with a script, except to licenses/README.md. Closes #9937
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
/*
|
|
* Copyright (C) 2019-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <experimental/source_location>
|
|
#include <functional>
|
|
#include <seastar/core/sstring.hh>
|
|
|
|
#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<bool(const std::exception&)> make(
|
|
std::function<bool(const std::exception&)> check,
|
|
std::function<sstring(const std::exception&)> err);
|
|
|
|
/// Returns a predicate that will check if the exception message contains the given fragment.
|
|
extern std::function<bool(const std::exception&)> message_contains(
|
|
const sstring& fragment,
|
|
const std::experimental::source_location& loc = std::experimental::source_location::current());
|
|
|
|
/// Returns a predicate that will check if the exception message equals the given text.
|
|
extern std::function<bool(const std::exception&)> message_equals(
|
|
const sstring& text,
|
|
const std::experimental::source_location& loc = std::experimental::source_location::current());
|
|
|
|
/// Returns a predicate that will check if the exception message matches the given regular expression.
|
|
extern std::function<bool(const std::exception&)> message_matches(
|
|
const std::string& regex,
|
|
const std::experimental::source_location& loc = std::experimental::source_location::current());
|
|
|
|
} // namespace exception_predicate
|