CodeChain-io / CodeChain-io/codechain-sdk-go

Handle RPC Error properly

Đang mở
#59 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
5
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Currently, if RPC error occurs, the error message just gives
`unexpected end of JSON input`
Because the error format provided by the rpc server is as follows:
```
{
code: -32032,
message: 'Not Enough Balance',
data: 'InsufficientBalance { address: Address(~~), balance: ~, cost: ~ }'
}
```

`unexpected end of JSON input` comes from line 75.
(`body` has the error message in byte slice)

https://github.com/CodeChain-io/codechain-sdk-go/blob/6ad3e76c4dfba22b0867764b8c67500dce7518d2/rpc/base.go#L64-L77

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Inspect rpc/base.go around lines 64-77, where the RPC response body is parsed and the unexpected JSON error originates. Trace how the byte-slice body contains the server's error message, then make completion mean that the RPC error details are surfaced instead of only reporting unexpected end of JSON input.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
go
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.