Open boingrach opened 2 days ago
Is there a reason for using BoxDynError?
I recommend using the concrete Error
type provided in apalis like in email_service
example or define your error type.
I will investigate a little more.
A lot of my services have tower layers applied. Some layers convert error into Box<dyn Error+...>
this gives a possible hint why original build_fn is not allowed
Some services do not need to pass real error, basic info is enough so boxed error suites well
Oh I see what you are looking for: Its the ErrorHandlerLayer. This layer should be the top most layer. Could you check if that fixes your issue?
kinda ErrorHandlerLayer works only for manual Service implementation
the fn case fails with errors
I have replicated your issue and ack that it is because of what constraints that ServiceFn
has.
Currently, there are several workarounds. I will spend some time on this within the coming days.
A lot of my services have tower layers applied. Some layers convert error into Box<dyn Error+...>
For this, the ErrorHandlingLayer
should work.
Hi, I'm using boxed error in worker function.
example
```rust use apalis::prelude::*; use apalis_sql::sqlite::SqliteStorage; use sqlx::SqlitePool; #[tokio::main] async fn main() -> anyhow::Result<()> { std::env::set_var("RUST_LOG", "debug,sqlx::query=info"); tracing_subscriber::fmt::init(); let pool = SqlitePool::connect("sqlite::memory:").await?; // Do migrations: Mainly for "sqlite::memory:" SqliteStorage::setup(&pool) .await .expect("unable to run migrations for sqlite"); let storage: SqliteStorageBut i'm getting errors
errors
``` error[E0277]: the trait bound `ServiceFnReplacing boxed error with concrete enum fixes errors
apalis v0.6.0