Browse Source

improve error message for json marshalling/unmarshalling (#5211)

Signed-off-by: Erik Westra <e.s.westra.95@gmail.com>
Erik Westra 9 months ago
parent
commit
7e81e545da

+ 1 - 1
pkg/provider/akeyless/utils.go

@@ -31,7 +31,7 @@ const (
 	errMissingStoreSpec             = "store is missing spec"
 	errMissingProvider              = "storeSpec is missing provider"
 	errInvalidProvider              = "invalid provider spec. Missing Akeyless field in store %s"
-	errJSONSecretUnmarshal          = "unable to unmarshal secret: %w"
+	errJSONSecretUnmarshal          = "unable to unmarshal secret from JSON: %w"
 	errUninitalizedAkeylessProvider = "provider akeyless is not initialized"
 	errInvalidAkeylessURL           = "invalid akeyless GW API URL"
 	errInvalidAkeylessAccessIDName  = "missing akeyless accessID name"

+ 1 - 1
pkg/provider/device42/device42_api.go

@@ -30,7 +30,7 @@ import (
 
 const (
 	DoRequestError         = "error: do request: %w"
-	errJSONSecretUnmarshal = "unable to unmarshal secret: %w"
+	errJSONSecretUnmarshal = "unable to unmarshal secret from JSON: %w"
 )
 
 type HTTPClient interface {

+ 1 - 1
pkg/provider/gcp/secretmanager/client.go

@@ -56,7 +56,7 @@ const (
 	errUnableCreateGCPSMClient      = "failed to create GCP secretmanager client: %w"
 	errUninitalizedGCPProvider      = "provider GCP is not initialized"
 	errClientGetSecretAccess        = "unable to access Secret from SecretManager Client: %w"
-	errJSONSecretUnmarshal          = "unable to unmarshal secret: %w"
+	errJSONSecretUnmarshal          = "unable to unmarshal secret from JSON: %w"
 
 	errInvalidStore           = "invalid store"
 	errInvalidStoreSpec       = "invalid store spec"

+ 1 - 1
pkg/provider/gitlab/gitlab.go

@@ -46,7 +46,7 @@ const (
 	errEnvironmentIsConstricted     = "'find.tags' is constrained by 'environment_scope' of the store"
 	errTagsOnlyEnvironmentSupported = "'find.tags' only supports 'environment_scope'"
 	errPathNotImplemented           = "'find.path' is not implemented in the GitLab provider"
-	errJSONSecretUnmarshal          = "unable to unmarshal secret: %w"
+	errJSONSecretUnmarshal          = "unable to unmarshal secret from JSON: %w"
 	errNotImplemented               = "not implemented"
 )
 

+ 2 - 2
pkg/provider/ibm/provider.go

@@ -52,8 +52,8 @@ const (
 
 	errIBMClient                = "cannot setup new ibm client: %w"
 	errUninitializedIBMProvider = "provider IBM is not initialized"
-	errJSONSecretUnmarshal      = "unable to unmarshal secret: %w"
-	errJSONSecretMarshal        = "unable to marshal secret: %w"
+	errJSONSecretUnmarshal      = "unable to unmarshal secret from JSON: %w"
+	errJSONSecretMarshal        = "unable to marshal secret to JSON: %w"
 	errExtractingSecret         = "unable to extract the fetched secret %s of type %s while performing %s"
 	errNotImplemented           = "not implemented"
 	errKeyDoesNotExist          = "key %s does not exist in secret %s"

+ 1 - 1
pkg/provider/oracle/oracle.go

@@ -55,7 +55,7 @@ const (
 	errMissingRegion              = "missing Region"
 	errMissingFingerprint         = "missing Fingerprint"
 	errMissingVault               = "missing Vault"
-	errJSONSecretUnmarshal        = "unable to unmarshal secret: %w"
+	errJSONSecretUnmarshal        = "unable to unmarshal secret from JSON: %w"
 	errMissingKey                 = "missing Key in secret: %s"
 	errUnexpectedContent          = "unexpected secret bundle content"
 	errSettingOCIEnvVariables     = "unable to set OCI SDK environment variable %s: %w"