Skip to main content

Function: formatErrorMessage()

function formatErrorMessage(
template: string,
params: Record<string, number | string>
): string;

Defined in: shared/utils/errorCatalog.ts:399

Helper function to create parameterized error messages.

Parametersโ€‹

templateโ€‹

string

Error message template with placeholders

paramsโ€‹

Record<string, number | string>

Parameters to substitute in the template

Returnsโ€‹

string

Formatted error message string

Exampleโ€‹

const message = formatErrorMessage("Invalid monitor status: {status}", {
status: "invalid",
});
// Returns: "Invalid monitor status: invalid"

const message = formatErrorMessage(
"Validator error for event '{event}': {error}",
{
event: "user:login",
error: "User ID required",
}
);
// Returns: "Validator error for event 'user:login': User ID required"