Skip to content

Commit c5b37e6

Browse files
nit
1 parent a3619e3 commit c5b37e6

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ members = [
1010
"./examples/tauri/src-tauri",
1111
"./examples/legacy",
1212
"./examples/binario",
13-
"./examples/anyhow-error",
13+
"./examples/anyhow",
1414
]
1515

1616
[workspace.dependencies]

examples/anyhow-error/Cargo.toml examples/anyhow/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[package]
2-
name = "anyhow-error"
3-
version = "0.1.0"
2+
name = "example-anyhow"
3+
version = "0.0.0"
44
edition = "2021"
5+
publish = false
56

67
[dependencies]
78
rspc = { path = "../../rspc", features = ["typescript"] }
File renamed without changes.

examples/anyhow-error/src/main.rs examples/anyhow/src/main.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rspc::{Procedure, Router};
2+
use specta::Type;
23

34
////////////////////////////////////////////////////////////////////////////////////////////////////
45

@@ -28,9 +29,13 @@ fn fallible() -> Result<String, anyhow::Error> {
2829
// Make `anyhow::Error` work where `std::error::Error + Send + 'static` is expected.
2930
// NB: Define this only once; afterwards, you can import and use it anywhere.
3031
// See: https://github.com/dtolnay/anyhow/issues/153#issuecomment-833718851
31-
#[derive(Debug, thiserror::Error)]
32+
#[derive(Debug, thiserror::Error, Type)]
3233
#[error(transparent)]
33-
struct AnyhowError(#[from] anyhow::Error);
34+
struct AnyhowError(
35+
#[from]
36+
#[serde(skip)]
37+
anyhow::Error,
38+
);
3439

3540
impl rspc::Error for AnyhowError {
3641
fn into_procedure_error(self) -> rspc::ProcedureError {

0 commit comments

Comments
 (0)