This documentation is deprecated. It covers rspc 0.3.0, which is no longer maintained.
Error Handling
rspc procedures have to return the type Result<T, rspc::Error> where T can be any type which can be returned from a normal procedure.
The fact that Rust as a language currently requires the error type to be concrete makes error handling slightly annoying. All of the error handling done by rspc relys on the question mark operator (?) in Rust to make a reasonable developer experience. The question mark operator will expand into something along the lines of return Err(From::from(err)) under the hood. This means for any type T if you implement From<T> for rspc::Error you will be able to rely on the question mark operator to convert it into an rspc::Error type.
An example using the rspc::Error type
src/main.rs
Custom error type
src/main.rs
