Skip to content

Commit a680105

Browse files
committed
feat(pyth-lazer) Add more context to ParseError in JRPC protocol
1 parent 01880f7 commit a680105

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lazer/sdk/rust/protocol/src/jrpc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,18 @@ pub struct JrpcErrorObject {
8787

8888
#[derive(Debug, Eq, PartialEq)]
8989
pub enum JrpcError {
90-
ParseError,
90+
ParseError(String),
9191
InternalError,
9292
}
9393

9494
// note: error codes can be found in the rfc https://www.jsonrpc.org/specification#error_object
9595
impl From<JrpcError> for JrpcErrorObject {
9696
fn from(error: JrpcError) -> Self {
9797
match error {
98-
JrpcError::ParseError => JrpcErrorObject {
98+
JrpcError::ParseError(error_message) => JrpcErrorObject {
9999
code: -32700,
100100
message: "Parse error".to_string(),
101-
data: None,
101+
data: Some(error_message.into()),
102102
},
103103
JrpcError::InternalError => JrpcErrorObject {
104104
code: -32603,

0 commit comments

Comments
 (0)