Skip to content

Add Error.ToString() so DigiCert's error text reaches the operator - #67

Open
Pichatorn-A4K wants to merge 1 commit into
Keyfactor:mainfrom
Pichatorn-A4K:fix/error-tostring
Open

Add Error.ToString() so DigiCert's error text reaches the operator#67
Pichatorn-A4K wants to merge 1 commit into
Keyfactor:mainfrom
Pichatorn-A4K:fix/error-tostring

Conversation

@Pichatorn-A4K

Copy link
Copy Markdown

Models.Error has no ToString() override, and two call sites interpolate the object rather than
Error.message:

// CertCentralCAPlugin.Ping()
throw new Exception($"Error attempting to ping DigiCert: {string.Join("\n", response.Errors)}");

// CertCentralCAPlugin.GetProductIds()
_logger.LogError($"Unable to retrieve product list: {productTypesResponse.Errors[0]}");

Both therefore render as:

Error attempting to ping DigiCert: Keyfactor.Extensions.CAPlugin.DigiCert.Models.Error

So a gateway operator testing a CA connection is shown a type name, and DigiCert's actual reason —
measured examples: access_denied|access_denied_invalid_key, access_denied|missing_permission,
product_not_allowed — appears nowhere in the message they see.

This adds the override rather than editing the call sites, so any future interpolation of an Error
is also readable. Null-safe in both directions: code-only and message-only errors render as the part
that exists.

🤖 Generated with Claude Code

Two call sites interpolate the Error object rather than Error.message:

  CertCentralCAPlugin.Ping()
    throw new Exception($"Error attempting to ping DigiCert: {string.Join("\n", response.Errors)}")

  CertCentralCAPlugin.GetProductIds()
    _logger.LogError($"Unable to retrieve product list: {productTypesResponse.Errors[0]}")

Without a ToString() override these render as
'Keyfactor.Extensions.CAPlugin.DigiCert.Models.Error', so the gateway
operator testing a CA connection is shown a type name and DigiCert's
actual reason (for example 'access_denied|access_denied_invalid_key')
appears nowhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant