From 62701fe8e95895f47eb685e85ff0c92051f8e330 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Fri, 19 Jul 2024 15:40:59 -0700 Subject: [PATCH 1/3] Add a generic client error --- crates/twirp/src/client.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/twirp/src/client.rs b/crates/twirp/src/client.rs index e4de595..a8d1dca 100644 --- a/crates/twirp/src/client.rs +++ b/crates/twirp/src/client.rs @@ -7,7 +7,7 @@ use thiserror::Error; use url::Url; use crate::headers::{CONTENT_TYPE_JSON, CONTENT_TYPE_PROTOBUF}; -use crate::{serialize_proto_message, TwirpErrorResponse}; +use crate::{serialize_proto_message, GenericError, TwirpErrorResponse}; #[derive(Debug, Error)] pub enum ClientError { @@ -36,6 +36,10 @@ pub enum ClientError { ReqwestError(#[from] reqwest::Error), #[error("twirp error: {0:?}")] TwirpError(TwirpErrorResponse), + + /// A generic error that can be used by custom middleware. + #[error(transparent)] + Generic(#[from] GenericError), } pub type Result = std::result::Result; From 11de1536ae27f354dddb58a3dfeb024cf875cff0 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Mon, 22 Jul 2024 17:06:44 -0700 Subject: [PATCH 2/3] Rename, non-exhaustive --- crates/twirp/src/client.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/twirp/src/client.rs b/crates/twirp/src/client.rs index a8d1dca..580cd96 100644 --- a/crates/twirp/src/client.rs +++ b/crates/twirp/src/client.rs @@ -10,6 +10,7 @@ use crate::headers::{CONTENT_TYPE_JSON, CONTENT_TYPE_PROTOBUF}; use crate::{serialize_proto_message, GenericError, TwirpErrorResponse}; #[derive(Debug, Error)] +#[non_exhaustive] pub enum ClientError { #[error(transparent)] InvalidHeader(#[from] InvalidHeaderValue), @@ -39,7 +40,7 @@ pub enum ClientError { /// A generic error that can be used by custom middleware. #[error(transparent)] - Generic(#[from] GenericError), + MiddlewareError(#[from] GenericError), } pub type Result = std::result::Result; From 78bf73504c5d41f780bc860bd680d16c79395bb8 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Mon, 22 Jul 2024 17:06:51 -0700 Subject: [PATCH 3/3] Version bump --- Cargo.lock | 4 ++-- crates/twirp-build/Cargo.toml | 2 +- crates/twirp/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9cb7376..ddbb352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1104,7 +1104,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "twirp" -version = "0.3.0" +version = "0.4.0" dependencies = [ "async-trait", "axum", @@ -1125,7 +1125,7 @@ dependencies = [ [[package]] name = "twirp-build" -version = "0.3.0" +version = "0.4.0" dependencies = [ "prost-build", ] diff --git a/crates/twirp-build/Cargo.toml b/crates/twirp-build/Cargo.toml index 4159a21..650577d 100644 --- a/crates/twirp-build/Cargo.toml +++ b/crates/twirp-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twirp-build" -version = "0.3.0" +version = "0.4.0" authors = ["The blackbird team "] edition = "2021" description = "Code generation for async-compatible Twirp RPC interfaces." diff --git a/crates/twirp/Cargo.toml b/crates/twirp/Cargo.toml index e6f3976..2259b37 100644 --- a/crates/twirp/Cargo.toml +++ b/crates/twirp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twirp" -version = "0.3.0" +version = "0.4.0" authors = ["The blackbird team "] edition = "2021" description = "An async-compatible library for Twirp RPC in Rust." pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy