From ef862ada846048d41cec2ba931a18820a2911586 Mon Sep 17 00:00:00 2001 From: Nathan Delhaye Date: Thu, 11 Apr 2024 10:11:52 +0200 Subject: [PATCH] Improve error message : add request ID --- ovh/helpers/helpers.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ovh/helpers/helpers.go b/ovh/helpers/helpers.go index 5fcae2a8d..300e7e276 100644 --- a/ovh/helpers/helpers.go +++ b/ovh/helpers/helpers.go @@ -362,9 +362,13 @@ func ConditionalAttributeBool(buff *bytes.Buffer, name string, val *bool) { // CheckDeleted checks the error to see if it's a 404 (Not Found) and, if so, // sets the resource ID to the empty string instead of throwing an error. func CheckDeleted(d *schema.ResourceData, err error, endpoint string) error { - if errOvh, ok := err.(*ovh.APIError); ok && errOvh.Code == 404 { - d.SetId("") - return nil + errOvh, ok := err.(*ovh.APIError) + if ok { + if errOvh.Code == 404 { + d.SetId("") + return nil + } + return fmt.Errorf("calling %s:\n\t %s Query ID : %s", endpoint, err.Error(), errOvh.QueryID) } return fmt.Errorf("calling %s:\n\t %s", endpoint, err.Error())