File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ func GetLatestBlock(rpcURL string) string {
4141 log .Fatalf ("Greska pri parsiranju JSON odgovora: %v" , err )
4242 }
4343
44+ if rpcResp .Error != nil {
45+ log .Fatalf (
46+ "RPC greska (code=%d): %s" ,
47+ rpcResp .Error .Code ,
48+ rpcResp .Error .Message ,
49+ )
50+ }
51+
4452 fmt .Println ("sadrzaj BLOCK-a:\n " , string (rpcResp .Result ))
4553 fmt .Println ()
4654
Original file line number Diff line number Diff line change @@ -9,10 +9,16 @@ type RPCRequest struct {
99 ID int `json:"id"`
1010}
1111
12+ type RPCError struct {
13+ Code int `json:"code"`
14+ Message string `json:"message"`
15+ }
16+
1217type RPCResponse struct {
1318 Jsonrpc string `json:"jsonrpc"`
1419 ID int `json:"id"`
15- Result json.RawMessage `json:"result"` // Sirovi JSON za parsiranje
20+ Result json.RawMessage `json:"result"`
21+ Error * RPCError `json:"error,omitempty"`
1622}
1723
1824type Block struct {
You can’t perform that action at this time.
0 commit comments