I have an error like this:
#[derive(Debug, Clone, Error, Serialize, Type)]
enum ApiError {
#[error("foo error")]
Foo,
}
impl rspc::Error for ApiError {
fn into_procedure_error(self) -> ProcedureError {
ResolverError::new(self.to_string(), Some(self)).into()
}
}
But returning this error displays the debug formatting instead of the message foo error:
"data": {
"code": 500,
"message": "Resolver(ResolverError(Some(Foo)))",
"data": null
}
Which is not very user-friendly. Is there a way to have better control of the error message?
It's worst when there's no source:
"data": {
"code": 500,
"message": "Resolver(ResolverError(None))",
"data": null
}
I have an error like this:
But returning this error displays the debug formatting instead of the message
foo error:Which is not very user-friendly. Is there a way to have better control of the error message?
It's worst when there's no source: