algorand / go-algorand-sdk

Algorand Golang SDK

Home Page:https://pkg.go.dev/github.com/algorand/go-algorand-sdk/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

msgpack decode masks http error

barnjamin opened this issue · comments

Subject of the issue

When calling something like client.Block(round).Do..., if there is an HTTP error, JSON is returned but we don't check status code and try to msgpack decode the result anyway.

This leads to the error seeming like its one with formatting and the real error is masked.

We should check the http status code here and return an error that wraps the resulting error message

What is the exact error being encountered and steps to reproduce?

I see the exact same issue - ie passing a block that doesn't exist will reproduce this. The node returns a 500 (instead of a 404 for some reason) and it comes back as a msgpack decode error.