This commit is contained in:
Dominik Werder
2023-09-01 16:51:08 +02:00
parent 7f75639e18
commit 488a681d0d
5 changed files with 41 additions and 6 deletions

View File

@@ -55,12 +55,12 @@ jobs:
- run: ls -la /root
- run: rustc --version
- run: cargo --version
- run: mkdir /build
- run: yum install -y git
- run: git clone https://github.com/paulscherrerinstitute/daqingest.git
- run: mkdir /build
- run: git clone --branch dev https://github.com/paulscherrerinstitute/daqbuffer.git
working-directory: /build
- run: git clone --branch dev https://github.com/paulscherrerinstitute/daqingest.git
working-directory: /build
- run: git checkout dev
working-directory: /build/daqingest
- run: cargo build
working-directory: /build/daqingest

View File

@@ -3,10 +3,13 @@ members = ["log", "netfetch", "daqingest"]
resolver = "2"
[profile.release]
opt-level = 3
opt-level = 2
debug = 0
overflow-checks = false
debug-assertions = false
lto = "thin"
codegen-units = 64
incremental = true
[patch.crates-io]
thiserror = { git = "https://github.com/dominikwerder/thiserror.git" }

View File

@@ -6,5 +6,6 @@ pub mod pool;
pub mod schema;
pub mod seriesbychannel;
pub mod seriesid;
pub mod testerr;
pub use tokio_postgres as postgres;

31
dbpg/src/testerr.rs Normal file
View File

@@ -0,0 +1,31 @@
use err::thiserror;
use err::ThisError;
use std::fmt;
#[derive(Debug)]
struct TestError {
msg: String,
}
impl fmt::Display for TestError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}", self.msg)
}
}
impl std::error::Error for TestError {}
#[derive(Debug, ThisError)]
enum Error {
Postgres(#[from] tokio_postgres::Error),
Dummy(#[from] TestError),
}
#[test]
fn err_msg_01() {
let err: Error = TestError {
msg: "some-error".into(),
}
.into();
assert_eq!(err.to_string(), "Error::Dummy(some-error)")
}

View File

@@ -6,6 +6,6 @@ edition = "2021"
[dependencies]
libc = "0.2"
thiserror = "1.0.47"
thiserror = "1.0.41"
log = { path = "../log" }
taskrun = { path = "../../daqbuffer/crates/taskrun" }