cloudwego / monolake

Rust framework for building high-performance network services
https://www.cloudwego.io/docs/monolake/
Apache License 2.0
15 stars 2 forks source link

refactor: use Anyhow as AnyError and replace serval AnyError to the typed error #99

Closed ihciah closed 5 months ago

ihciah commented 5 months ago
  1. Previously I use type AnyError = Box<dyn Error + Send + Sync>, but since AnyError does not implement Error, AnyError cannot be converted to AnyError(ref). Here I choose Anyhow as generic error representation.
  2. Some Service implemetations use AnyError as its returned Error type. When user want to get precise error, it becomes difficult, no matter AnyError is Box dyn or Anyhow. The best way it to define its error as enum and return it. I changed some Services' error in this PR.