Class FRPolicyAbstract

Utility for processing policy failures into human readable messages.

Example:

// Create message overrides and extensions as needed
const messageCreator = {
[PolicyKey.unique]: (property: string) => (
`this is a custom message for "UNIQUE" policy of ${property}`
),
CUSTOM_POLICY: (property: string, params: any) => (
`this is a custom message for "${params.policyRequirement}" policy of ${property}`
),
};

const thisStep = await FRAuth.next(previousStep);

if (thisStep.type === StepType.LoginFailure) {
const messagesStepMethod = thisStep.getProcessedMessage(messageCreator);
const messagesClassMethod = FRPolicy.parseErrors(thisStep, messageCreator)
}

Constructors

Methods

  • Parses a failed policy and returns a string array of error messages.

    Parameters

    Returns string[]

    Array of strings with all processed policy errors.

  • Parses a policy error into a human readable error message.

    Parameters

    Returns string

    Human readable error message.