Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:DevExpress Testcafe ErrorTypes

From Leeroopedia
Knowledge Sources
Domains Error Handling, Shared
Last Updated 2026-02-12 12:00 GMT

Overview

ErrorTypes defines all error code constants used across TestCafe, organized into two exported enumerations: TEST_RUN_ERRORS for errors that occur during test execution and RUNTIME_ERRORS for errors that occur in the runner/infrastructure layer.

Description

src/errors/types.js is a shared module used by both the client (browser) and the server (Node.js) -- it must not use any browser-specific or Node-specific APIs. It exports two constant objects:

TEST_RUN_ERRORS (codes E1 through E102) -- Errors that happen within a test run context:

  • E1-E8: Uncaught errors (on page, in test code, in client functions, unhandled promise rejections, missing awaits)
  • E9-E22: Action argument validation errors (integer, boolean, speed, string, role, selector options)
  • E23-E44: Element interaction errors (not found, invisible, wrong node type, non-editable, iframe issues)
  • E45-E48: Native dialog errors (not handled, handler code errors, wrong type)
  • E49-E61: Client function, selector, assertion, and page load errors
  • E62-E67: Request hook and custom client script errors
  • E68-E84: Multi-window errors (child window not loaded, cannot switch, close, restore) and execution timeout
  • E85-E102: Cookie argument errors, additional option type errors, skip-js-errors, and native automation conflicts

RUNTIME_ERRORS (codes E1000 through E1086) -- Infrastructure and configuration errors:

  • E1000-E1007: Runner lifecycle errors (live mode, browser connection, browser not set)
  • E1008-E1019: Configuration errors (no test files, no tests to run, reporter not found, invalid options)
  • E1020-E1029: Client function and selector initialization errors
  • E1030-E1054: Advanced configuration (video options, SSL certs, IPC errors, raw file parsing)
  • E1057-E1086: Environment errors (no display, reporter errors, TypeScript compiler, quarantine, ESM import, native automation)

Usage

Import these constants anywhere an error needs to be created or identified by code. The string values (e.g. 'E1', 'E1000') serve as stable identifiers that can be matched by error message templates and by test assertions. Because the file is shared between client and server, it uses no platform-specific APIs.

Code Reference

Source Location

src/errors/types.js (193 lines)

Signature

export const TEST_RUN_ERRORS = {
    uncaughtErrorOnPage:                      'E1',
    uncaughtErrorInTestCode:                  'E2',
    uncaughtNonErrorObjectInTestCode:         'E3',
    uncaughtErrorInClientFunctionCode:        'E4',
    uncaughtErrorInCustomDOMPropertyCode:     'E5',
    unhandledPromiseRejection:                'E6',
    uncaughtException:                        'E7',
    missingAwaitError:                        'E8',
    // ... action/element/assertion/hook errors E9-E102
};

export const RUNTIME_ERRORS = {
    cannotCreateMultipleLiveModeRunners:      'E1000',
    cannotRunLiveModeRunnerMultipleTimes:     'E1001',
    browserDisconnected:                      'E1002',
    // ... infrastructure/config errors E1003-E1086
};

Import

import { TEST_RUN_ERRORS, RUNTIME_ERRORS } from '../../errors/types';

I/O Contract

Inputs

This module has no inputs. It is a pure constant definition module with no constructor, function parameters, or side effects.

Outputs

Export Type Description
TEST_RUN_ERRORS Object<string, string> Maps camelCase error names to string codes in the range 'E1' through 'E102'. Contains 100 entries covering all test-run-scoped error conditions.
RUNTIME_ERRORS Object<string, string> Maps camelCase error names to string codes in the range 'E1000' through 'E1086'. Contains 83 entries covering all runtime/infrastructure error conditions.

Usage Examples

Creating a runtime error:

import { RUNTIME_ERRORS } from '../../errors/types';
import { GeneralError } from '../../errors/runtime';

throw new GeneralError(RUNTIME_ERRORS.cannotFindSpecifiedTestSource, filePath);

Checking a test-run error type:

import { TEST_RUN_ERRORS } from '../../errors/types';

if (error.code === TEST_RUN_ERRORS.uncaughtErrorOnPage) {
    // Handle page-level uncaught error
}

Using in error message templates:

import { TEST_RUN_ERRORS } from '../../errors/types';

// Error templates are keyed by these codes
const errorTemplates = {
    [TEST_RUN_ERRORS.actionElementNotFoundError]: 'The specified selector does not match any element...',
    [TEST_RUN_ERRORS.pageLoadError]:              'Failed to load the page at "{url}"...',
};

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment