summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-02-23 15:07:13 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-02-23 15:17:43 +0100
commite231c3e62e7724203595b484a2cf8a7357cb9d84 (patch)
tree1c694d3b7dd06c226af24ada2a55926cc34b572f /store
parentafbe6667f98dd9396c102e9c5b033681c2dcf6b2 (diff)
store: Do not display backend errors in debug builds.
- Instead, make them configurable so they can be used when needed.
Diffstat (limited to 'store')
-rw-r--r--store/src/macros.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/store/src/macros.rs b/store/src/macros.rs
index 2c44c229..a828313d 100644
--- a/store/src/macros.rs
+++ b/store/src/macros.rs
@@ -59,11 +59,16 @@ macro_rules! make_request_map {
/// beginning of the function.
macro_rules! bind_results {
( $results: ident ) => {
+ #[allow(unused)]
+ const DEBUG_BACKEND_ERRORS: bool = false;
+
/// Behaves like `return Err(_)` for server functions.
#[allow(unused_macros)]
macro_rules! fail {
( $expr:expr ) => {{
- eprintln!("{}:{}: {:?}", file!(), line!(), $expr);
+ if DEBUG_BACKEND_ERRORS {
+ eprintln!("{}:{}: {:?}", file!(), line!(), $expr);
+ }
pry!($results.get().get_result()).set_err($expr);
return Promise::ok(());
}};
@@ -79,8 +84,9 @@ macro_rules! bind_results {
match $expr {
Ok(x) => x,
Err(x) => {
- #[cfg(debug_assertions)]
- eprintln!("{}:{}: {:?}", file!(), line!(), x);
+ if DEBUG_BACKEND_ERRORS {
+ eprintln!("{}:{}: {:?}", file!(), line!(), x);
+ }
pry!($results.get().get_result()).set_err(x.into());
return Promise::ok(());
},