Skip to main content

JwtValidationError Class

Abblix.Jwt

Abblix.Jwt

JwtValidationError Class

Represents an error encountered during the validation of a JSON Web Token (JWT).

public record JwtValidationError : System.IEquatable<Abblix.Jwt.JwtValidationError>

Inheritance System.Object → JwtValidationError

Implements System.IEquatable<JwtValidationError>

Constructors

JwtValidationError(JwtError, string) Constructor

Represents an error encountered during the validation of a JSON Web Token (JWT).

public JwtValidationError(Abblix.Jwt.JwtError Error, string ErrorDescription);

Parameters

Error JwtError

The specific type of JWT error encountered.

ErrorDescription System.String

A description of the error providing details about the validation failure.

Properties

JwtValidationError.Error Property

The specific type of JWT error encountered.

public Abblix.Jwt.JwtError Error { get; init; }

Property Value

JwtError

JwtValidationError.ErrorDescription Property

A description of the error providing details about the validation failure.

public string ErrorDescription { get; init; }

Property Value

System.String

Methods

JwtValidationError.ToString() Method

Returns the error description as the textual representation of this validation error, preserving the original capitalization of ErrorDescription.

public override string ToString();

Returns

System.String

JwtValidationError.ToString(bool) Method

Formats a user-friendly description of the JWT validation error with proper sentence capitalization.

public string ToString(bool forceLowercaseFirst);

Parameters

forceLowercaseFirst System.Boolean

If true, converts the first letter to lowercase for embedding in larger sentences. If false, preserves the original capitalization. Default is true.

Returns

System.String
The error description, optionally with the first letter in lowercase if a description is available, otherwise returns the error code as a string.

Remarks

This method is useful for embedding error descriptions in the middle of sentences, where starting with a lowercase letter maintains proper grammar. Example with forceLowercaseFirst=true: "The id token hint contains invalid token: token has expired" Example with forceLowercaseFirst=false: "Token has expired"