fn: add fetch API error code helper function (#800)

This commit is contained in:
Tolga Ceylan
2018-02-27 14:30:58 -08:00
committed by GitHub
parent 98df0aba94
commit 222e06f5f5

View File

@@ -204,6 +204,14 @@ func IsAPIError(e error) bool {
return ok
}
func GetAPIErrorCode(e error) int {
err, ok := e.(APIError)
if ok {
return err.Code()
}
return 0
}
// Error uniform error output
type Error struct {
Error *ErrorBody `json:"error,omitempty"`