angular/goldens/public-api/core/errors.md
Andrew Kushnir ed1732c268 refactor(core): the RuntimeError class should support more compact syntax (#44783)
This commit refactors the `RuntimeError` class to support a short version of providing error messages:
```
throw new RuntimeError(
  RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
  ngDevMode && 'Injector has already been destroyed.');
```
In prod mode, the second argument becomes `false` andn this commit extends the typings to support that.

This commit also contains a couple places were the `RuntimeError` class is used to demostrate the compact form.

PR Close #44783
2022-02-01 00:15:56 +00:00

2.1 KiB

API Report File for "angular-srcs"

Do not edit this file. It is a report generated by API Extractor.


// @public
export function formatRuntimeError<T extends number = RuntimeErrorCode>(code: T, message: null | false | string): string;

// @public
export class RuntimeError<T extends number = RuntimeErrorCode> extends Error {
    constructor(code: T, message: null | false | string);
    // (undocumented)
    code: T;
}

// @public
export const enum RuntimeErrorCode {
    // (undocumented)
    ALREADY_DESTROYED_PLATFORM = 404,
    // (undocumented)
    ASYNC_INITIALIZERS_STILL_RUNNING = 405,
    // (undocumented)
    BOOTSTRAP_COMPONENTS_NOT_FOUND = 403,
    // (undocumented)
    CYCLIC_DI_DEPENDENCY = -200,
    // (undocumented)
    ERROR_HANDLER_NOT_FOUND = 402,
    // (undocumented)
    EXPORT_NOT_FOUND = -301,
    // (undocumented)
    EXPRESSION_CHANGED_AFTER_CHECKED = -100,
    // (undocumented)
    INJECTOR_ALREADY_DESTROYED = 205,
    // (undocumented)
    INVALID_DIFFER_INPUT = 900,
    // (undocumented)
    INVALID_EVENT_BINDING = 306,
    // (undocumented)
    INVALID_FACTORY_DEPENDENCY = 202,
    // (undocumented)
    INVALID_I18N_STRUCTURE = 700,
    // (undocumented)
    INVALID_INHERITANCE = 903,
    // (undocumented)
    INVALID_INJECTION_TOKEN = 204,
    // (undocumented)
    MISSING_INJECTION_CONTEXT = 203,
    // (undocumented)
    MULTIPLE_COMPONENTS_MATCH = -300,
    // (undocumented)
    MULTIPLE_PLATFORMS = 400,
    // (undocumented)
    NO_SUPPORTING_DIFFER_FACTORY = 901,
    // (undocumented)
    PIPE_NOT_FOUND = -302,
    // (undocumented)
    PLATFORM_NOT_FOUND = 401,
    // (undocumented)
    PROVIDER_NOT_FOUND = -201,
    // (undocumented)
    RECURSIVE_APPLICATION_REF_TICK = 101,
    // (undocumented)
    TEMPLATE_STRUCTURE_ERROR = 305,
    // (undocumented)
    UNKNOWN_BINDING = 303,
    // (undocumented)
    UNKNOWN_ELEMENT = 304,
    // (undocumented)
    UNSAFE_VALUE_IN_RESOURCE_URL = 904,
    // (undocumented)
    UNSAFE_VALUE_IN_SCRIPT = 905,
    // (undocumented)
    VIEW_ALREADY_ATTACHED = 902
}

// (No @packageDocumentation comment for this package)