Function to_json_rpc_error

Source
pub fn to_json_rpc_error<E: Display>(err: E) -> JsonRpcError
Expand description

Generic error mapper for JsonRpcError

This function creates an internal error JsonRpcError with the provided error’s message. Use this for server-side error mapping when you can’t use the ? operator.

§Example

use acai::error::to_json_rpc_error;

let std_error = std::io::Error::new(std::io::ErrorKind::NotFound, "File not found");
let json_rpc_error = to_json_rpc_error(std_error);