@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
33use std:: { collections:: HashMap , str:: FromStr , time:: Duration } ;
44
55// Import RPC types from parent module
6- use crate :: wasi:: rpc:: { JsonRpcError , JsonRpcResponse , RPC_VERSION } ;
6+ use crate :: wasi:: rpc:: { JsonRpcError , JsonRpcErrorCode , JsonRpcResponse , RPC_VERSION } ;
77
88// HTTP request structures matching the SDK
99#[ derive( Debug , Clone , Serialize , Deserialize ) ]
@@ -93,7 +93,7 @@ pub async fn handle_http_request(params: Option<serde_json::Value>, id: u32) ->
9393 jsonrpc : RPC_VERSION . to_string ( ) ,
9494 result : None ,
9595 error : Some ( JsonRpcError {
96- code : - 32602 ,
96+ code : JsonRpcErrorCode :: InvalidParams as i32 ,
9797 message : "Invalid params" . to_string ( ) ,
9898 data : Some ( serde_json:: json!( {
9999 "error" : "Missing HTTP request parameters"
@@ -115,7 +115,7 @@ pub async fn handle_http_request(params: Option<serde_json::Value>, id: u32) ->
115115 jsonrpc : RPC_VERSION . to_string ( ) ,
116116 result : None ,
117117 error : Some ( JsonRpcError {
118- code : - 32603 ,
118+ code : JsonRpcErrorCode :: InternalError as i32 ,
119119 message : "Internal error" . to_string ( ) ,
120120 data : Some ( serde_json:: json!( {
121121 "error" : format!( "Failed to serialize result: {}" , e)
0 commit comments