Skip to main content

shared/utils/errorCatalog

Centralized error message catalog for consistent error handling across the application.

Remarksโ€‹

This module provides a comprehensive collection of standardized error messages organized by domain and operation type. Using these constants ensures consistent error messaging across frontend, backend, and shared code while improving maintainability and preventing typos.

The error messages are categorized by functional domain:

  • Site Operations: Site CRUD and management operations
  • Monitor Operations: Monitor configuration and management
  • Validation Errors: Data validation and constraint violations
  • System Errors: General system and infrastructure errors
  • Network Errors: Connection and communication errors
  • Database Errors: Data persistence and retrieval errors

Exampleโ€‹

import { ERROR_CATALOG } from "@shared/utils/errorCatalog";

// Use categorized error messages
throw new https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error(ERROR_CATALOG.sites.notFound);
throw new https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error(ERROR_CATALOG.monitors.configurationInvalid);

Interfacesโ€‹

Type Aliasesโ€‹

Variablesโ€‹

Functionsโ€‹