Skip to content

Commit

Permalink
refactor: improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDecMeetsMore committed Sep 2, 2024
1 parent 91818a5 commit 84328a0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions scheduler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ nettu_scheduler_api = { path = "./crates/api" }
nettu_scheduler_domain = { path = "./crates/domain" }
nettu_scheduler_infra = { path = "./crates/infra" }

anyhow = "1.0"

actix-web = "4.8"

tokio = { version = "1", features = ["full"] }
Expand Down
2 changes: 1 addition & 1 deletion scheduler/crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async-trait = "0.1.42"
rrule = "0.12.0"
chrono = { version = "0.4.19", features = ["serde"] }
chrono-tz = "0.8.1"
anyhow = "1.0.0"
anyhow = "1.0"
jsonwebtoken = "7"
thiserror = "1.0"
tracing = "0.1.25"
Expand Down
4 changes: 2 additions & 2 deletions scheduler/crates/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ impl Application {
Ok((server, port))
}

pub async fn start(self) -> Result<(), std::io::Error> {
pub async fn start(self) -> anyhow::Result<()> {
self.init_default_account().await;
self.server.await
self.server.await.map_err(|e| anyhow::anyhow!(e))
}

async fn init_default_account(&self) {
Expand Down
2 changes: 1 addition & 1 deletion scheduler/crates/domain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde = { version = "1.0", features = ["derive"] }
rrule = "0.12.0"
chrono = { version = "0.4.19", features = ["serde"] }
chrono-tz = { version = "0.8.1", features = ["serde"] }
anyhow = "1.0.0"
anyhow = "1.0"
url = "2.2.0"
uuid = { version = "1.1.2", features = ["serde", "v4"] }
jsonwebtoken = "7"
Expand Down
2 changes: 1 addition & 1 deletion scheduler/crates/infra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde_json = "1"
async-trait = "0.1.42"
chrono = { version = "0.4.19", features = ["serde"] }
chrono-tz = { version = "0.8.1", features = ["serde"] }
anyhow = "1.0.0"
anyhow = "1.0"
tokio = { version = "1", features = ["macros"] }
tracing = "0.1.25"
reqwest = { version = "0.12", features = ["json"] }
Expand Down
3 changes: 3 additions & 0 deletions scheduler/debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ RUN --mount=type=bind,source=src,target=/app/${APP_NAME}/src \

FROM debian:stable-slim

# Enable backtraces
ENV RUST_BACKTRACE=1

RUN apt update \
&& apt install -y openssl ca-certificates \
&& apt clean \
Expand Down
2 changes: 1 addition & 1 deletion scheduler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use nettu_scheduler_infra::setup_context;
use telemetry::init_subscriber;

#[tokio::main]
async fn main() -> std::io::Result<()> {
async fn main() -> anyhow::Result<()> {
// Initialize the environment variables for SSL certificates
openssl_probe::init_ssl_cert_env_vars();

Expand Down

0 comments on commit 84328a0

Please sign in to comment.