mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: add fetch API error code helper function (#800)
This commit is contained in:
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user