diff --git a/Dockerfile.useCurrentArch b/Dockerfile.useCurrentArch index a66050930..34a69462e 100644 --- a/Dockerfile.useCurrentArch +++ b/Dockerfile.useCurrentArch @@ -25,6 +25,7 @@ COPY crates/core/presence/Cargo.toml ./crates/core/presence/ COPY crates/core/result/Cargo.toml ./crates/core/result/ COPY crates/services/autumn/Cargo.toml ./crates/services/autumn/ COPY crates/services/january/Cargo.toml ./crates/services/january/ +COPY crates/daemons/pushd/Cargo.toml ./crates/daemons/pushd/ RUN sh /tmp/build-image-layer.sh deps # Build all apps diff --git a/crates/core/config/src/lib.rs b/crates/core/config/src/lib.rs index b103a0718..14b500e1f 100644 --- a/crates/core/config/src/lib.rs +++ b/crates/core/config/src/lib.rs @@ -23,6 +23,17 @@ macro_rules! report_error { }; } +#[cfg(feature = "report-macros")] +#[macro_export] +macro_rules! capture_internal_error { + ( $expr: expr ) => { + $crate::capture_message( + &format!("{:?} ({}:{}:{})", $expr, file!(), line!(), column!()), + $crate::Level::Error, + ); + }; +} + #[cfg(feature = "report-macros")] #[macro_export] macro_rules! report_internal_error { diff --git a/crates/core/database/src/lib.rs b/crates/core/database/src/lib.rs index 48f93f81a..9e26336d1 100644 --- a/crates/core/database/src/lib.rs +++ b/crates/core/database/src/lib.rs @@ -25,6 +25,26 @@ pub use mongodb; #[macro_use] extern crate bson; +#[macro_export] +#[cfg(debug_assertions)] +macro_rules! query { + ( $self: ident, $type: ident, $collection: expr, $($rest:expr),+ ) => { + Ok($self.$type($collection, $($rest),+).await.unwrap()) + }; +} + +#[macro_export] +#[cfg(not(debug_assertions))] +macro_rules! query { + ( $self: ident, $type: ident, $collection: expr, $($rest:expr),+ ) => { + $self.$type($collection, $($rest),+).await + .map_err(|err| { + revolt_config::capture_internal_error!(err); + create_database_error!(stringify!($type), $collection) + }) + }; +} + macro_rules! database_derived { ( $( $item:item )+ ) => { $( diff --git a/crates/core/result/src/lib.rs b/crates/core/result/src/lib.rs index 922a7676f..f3de55cd0 100644 --- a/crates/core/result/src/lib.rs +++ b/crates/core/result/src/lib.rs @@ -189,23 +189,6 @@ macro_rules! create_database_error { }; } -#[macro_export] -#[cfg(debug_assertions)] -macro_rules! query { - ( $self: ident, $type: ident, $collection: expr, $($rest:expr),+ ) => { - Ok($self.$type($collection, $($rest),+).await.unwrap()) - }; -} - -#[macro_export] -#[cfg(not(debug_assertions))] -macro_rules! query { - ( $self: ident, $type: ident, $collection: expr, $($rest:expr),+ ) => { - $self.$type($collection, $($rest),+).await - .map_err(|_| create_database_error!(stringify!($type), $collection)) - }; -} - #[cfg(test)] mod tests { use crate::ErrorType;