Skip to content

Commit

Permalink
remove redundant information from RPC error reason field
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Jan 15, 2025
1 parent 1ec4709 commit e9730c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion capnp-rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ fn to_pipeline_ops(
}

fn from_error(error: &Error, mut builder: exception::Builder) {
builder.set_reason(error.to_string());
let typ = match error.kind {
::capnp::ErrorKind::Failed => exception::Type::Failed,
::capnp::ErrorKind::Overloaded => exception::Type::Overloaded,
Expand All @@ -368,6 +367,17 @@ fn from_error(error: &Error, mut builder: exception::Builder) {
_ => exception::Type::Failed,
};
builder.set_type(typ);
match error.kind {
::capnp::ErrorKind::Failed
| ::capnp::ErrorKind::Overloaded
| ::capnp::ErrorKind::Disconnected
| ::capnp::ErrorKind::Unimplemented => {
builder.set_reason(&error.extra);
}
_ => {
builder.set_reason(error.to_string());
}
}
}

fn remote_exception_to_error(exception: exception::Reader) -> Error {
Expand Down

0 comments on commit e9730c8

Please sign in to comment.