@pho9ubenaa/remark-mask-text-beta
Version:
A remark plugin to mask text content with block characters
37 lines (36 loc) • 1 kB
TypeScript
/**
* Error type definitions for remark-mask-text plugin
*
* Why (Business Logic Background):
* - Systematically classify errors that may occur during plugin processing
* - Enable appropriate handling based on error type
* - Enable quick identification of error causes during debugging
* - Provide clear error messages to users
*/
/**
* Union type representing all possible processing errors
*
* This discriminated union provides type-safe error handling for all
* error conditions that may occur during text processing and AST manipulation.
*/
export type ProcessingError = {
type: "INVALID_DELIMITER";
message: string;
detail: string;
} | {
type: "INVALID_MASK_CHARACTER";
message: string;
detail: string;
} | {
type: "INVALID_NODE_STRUCTURE";
message: string;
nodeType: string;
} | {
type: "REGEX_PROCESSING_ERROR";
message: string;
pattern: string;
} | {
type: "AST_TRANSFORMATION_ERROR";
message: string;
context: string;
};