2018-08-30 14:54:42 +02:00
|
|
|
package hexonet
|
|
|
|
|
|
|
|
import (
|
Switch to Go 1.13 error wrapping (#604)
* Replaced errors.Wrap with fmt.Errorf (#589)
* Find: errors\.Wrap\(([^,]+),\s+(["`][^"`]*)(["`])\)
Replace: fmt.Errorf($2: %w$3, $1)
* Replaced errors.Wrapf with fmt.Errorf (#589)
* Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])\)
Replace: fmt.Errorf($2: %w$3, $1)
* Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])(,[^)]+)\)
* Replace: fmt.Errorf($2: %w$3$4, $1)
* Replaced errors.Errorf with fmt.Errorf (#589)
* Find: errors\.Errorf
Replace: fmt.Errorf
* Cleaned up remaining imports
* Cleanup
* Regenerate provider support matrix
This was broken by #533 ... and it's now the third time this has been missed.
2020-01-28 11:06:56 -05:00
|
|
|
"fmt"
|
2021-04-13 13:30:32 +02:00
|
|
|
"github.com/hexonet/go-sdk/v3/response"
|
2018-08-30 14:54:42 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// GetHXApiError returns an error including API error code and error description.
|
2020-02-27 10:04:17 -08:00
|
|
|
func (n *HXClient) GetHXApiError(format string, objectid string, r *response.Response) error {
|
2022-03-24 15:43:37 -04:00
|
|
|
return fmt.Errorf(format+" %q. [%v %s]", objectid, r.GetCode(), r.GetDescription())
|
2018-08-30 14:54:42 +02:00
|
|
|
}
|