eteu-technologies/near-api-go

How to distinguish error types

vic-dayou opened this issue · 2 comments

The error response of near rpc, error.cause.name can distinguish the error type, but near-api-go does not marsh this information to the error struct, because the error struct does not have a cause field, why not add the cause field to the error struct, like

type Cause struct {
	Info interface{} `json:"info"`
	Name string      `json:"name"`
}

type Error struct {
	Cause   Cause           `json:"cause"`
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

I think this is solved now.