Skip to main content

tsoracle_server/
failpoint.rs

1//
2//  ░▀█▀░█▀▀░█▀█░█▀▄░█▀█░█▀▀░█░░░█▀▀
3//  ░░█░░▀▀█░█░█░█▀▄░█▀█░█░░░█░░░█▀▀
4//  ░░▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
5//
6//  tsoracle — Distributed Timestamp Oracle
7//
8//  Copyright (c) 2026 Prisma Risk
9//  Licensed under the Apache License, Version 2.0
10//  https://github.com/prisma-risk/tsoracle
11//
12
13//! Per-crate failpoint wrapper. See `docs/failpoint-testing.md` for the
14//! conventions enforced here: source sites never reference `fail::` directly;
15//! they go through `crate::failpoint!`.
16//!
17//! With `feature = "failpoints"` off, both forms expand to `()` and the
18//! `fail` crate is not in the build graph.
19
20#[cfg(feature = "failpoints")]
21#[macro_export]
22macro_rules! failpoint {
23    ($name:expr) => {
24        fail::fail_point!($name)
25    };
26    ($name:expr, $closure:expr) => {
27        fail::fail_point!($name, $closure)
28    };
29}
30
31#[cfg(not(feature = "failpoints"))]
32#[macro_export]
33macro_rules! failpoint {
34    ($name:expr) => {
35        ()
36    };
37    ($name:expr, $closure:expr) => {
38        ()
39    };
40}