Andrew Pryde 6fd2f6701d
Rename Oracle BMCS builder to OCI
Oracle Bare Metal Cloud Services (BMCS) has been rebranded as Oracle
Cloud Infrastructure (OCI).
2017-09-12 10:40:56 -07:00

28 lines
535 B
Go

package oci
import "fmt"
// APIError encapsulates an error returned from the API
type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
}
func (e APIError) Error() string {
return fmt.Sprintf("OCI: [%s] '%s'", e.Code, e.Message)
}
// firstError is a helper function to work out which error to return from calls
// to the API.
func firstError(err error, apiError *APIError) error {
if err != nil {
return err
}
if apiError != nil && len(apiError.Code) > 0 {
return apiError
}
return nil
}