Documents injecute 1.x · Migrating from 0.x
Skip to content

Variable: errorCodes ​

const errorCodes: object

Defined in: src/error-codes.ts:10

Every error injecute throws, with a short title and how to fix it. The docs pages under /errors/<slug> are generated from this list.

Type Declaration ​

INJECUTE_ALREADY_REGISTERED ​

readonly INJECUTE_ALREADY_REGISTERED: object

INJECUTE_ALREADY_REGISTERED.hint ​

readonly hint: "Pass { replace: true } to replace the registration, or use another key. In a fork, { replace: true } is needed to override a parent's key too, and the override reaches only services resolved in the fork: services registered in the parent keep the parent's one. To replace it for every service, use fork({ isolated: true })." = "Pass { replace: true } to replace the registration, or use another key. In a fork, { replace: true } is needed to override a parent's key too, and the override reaches only services resolved in the fork: services registered in the parent keep the parent's one. To replace it for every service, use fork({ isolated: true })."

INJECUTE_ALREADY_REGISTERED.title ​

readonly title: "The key is already registered in this container or a parent" = 'The key is already registered in this container or a parent'

INJECUTE_CIRCULAR_DEPENDENCY ​

readonly INJECUTE_CIRCULAR_DEPENDENCY: object

INJECUTE_CIRCULAR_DEPENDENCY.hint ​

readonly hint: "Break the cycle: extract the shared part into its own service, or resolve one side lazily with a function dependency (() => container.get(key))." = 'Break the cycle: extract the shared part into its own service, or resolve one side lazily with a function dependency (() => container.get(key)).'

INJECUTE_CIRCULAR_DEPENDENCY.title ​

readonly title: "Services depend on each other in a cycle" = 'Services depend on each other in a cycle'

INJECUTE_CLASS_NOT_CONSTRUCTED ​

readonly INJECUTE_CLASS_NOT_CONSTRUCTED: object

INJECUTE_CLASS_NOT_CONSTRUCTED.hint ​

readonly hint: "Classes compiled to ES5 (Babel for old browsers, TypeScript target: es5) and bound classes cannot be detected. Register them with construct(MyClass)." = 'Classes compiled to ES5 (Babel for old browsers, TypeScript target: es5) and bound classes cannot be detected. Register them with construct(MyClass).'

INJECUTE_CLASS_NOT_CONSTRUCTED.title ​

readonly title: "A class was called without new" = 'A class was called without new'

INJECUTE_DISPOSE_FAILED ​

readonly INJECUTE_DISPOSE_FAILED: object

INJECUTE_DISPOSE_FAILED.hint ​

readonly hint: "Every other service was still disposed. The failures are in `cause` (an AggregateError)." = 'Every other service was still disposed. The failures are in `cause` (an AggregateError).'

INJECUTE_DISPOSE_FAILED.title ​

readonly title: "Some services failed to dispose" = 'Some services failed to dispose'

INJECUTE_DISPOSED ​

readonly INJECUTE_DISPOSED: object

INJECUTE_DISPOSED.hint ​

readonly hint: "Create a new container (or fork) instead of using one after dispose()." = 'Create a new container (or fork) instead of using one after dispose().'

INJECUTE_DISPOSED.title ​

readonly title: "The container is disposed" = 'The container is disposed'

INJECUTE_EXTENSION_RESULT ​

readonly INJECUTE_EXTENSION_RESULT: object

INJECUTE_EXTENSION_RESULT.hint ​

readonly hint: "A module function must return the registry it received (after adding services) or a fork of it." = 'A module function must return the registry it received (after adding services) or a fork of it.'

INJECUTE_EXTENSION_RESULT.title ​

readonly title: "An extension returned a container that is not this one or its child" = 'An extension returned a container that is not this one or its child'

INJECUTE_INVALID_DEPENDENCY ​

readonly INJECUTE_INVALID_DEPENDENCY: object

INJECUTE_INVALID_DEPENDENCY.hint ​

readonly hint: "Dependencies are service keys, optional(key), collect(tag) with a tag made by createTag(), or functions that return the value." = 'Dependencies are service keys, optional(key), collect(tag) with a tag made by createTag(), or functions that return the value.'

INJECUTE_INVALID_DEPENDENCY.title ​

readonly title: "A dependency is not a key, optional(key), collect(tag) or a function" = 'A dependency is not a key, optional(key), collect(tag) or a function'

INJECUTE_INVALID_FACTORY ​

readonly INJECUTE_INVALID_FACTORY: object

INJECUTE_INVALID_FACTORY.hint ​

readonly hint: "Pass a function that creates the service, a class, or use addInstance() for a ready value." = 'Pass a function that creates the service, a class, or use addInstance() for a ready value.'

INJECUTE_INVALID_FACTORY.title ​

readonly title: "The factory is not a function or class" = 'The factory is not a function or class'

INJECUTE_INVALID_HOOK ​

readonly INJECUTE_INVALID_HOOK: object

INJECUTE_INVALID_HOOK.hint ​

readonly hint: "A key that ends with `:<stage>` is a lifecycle hook. Register it with addSingleton() under `lifecycle.<stage>(name)`, and let it depend on services, never on other hooks: order hooks with stages. Rename a key that is not meant as a hook." = 'A key that ends with `:<stage>` is a lifecycle hook. Register it with addSingleton() under `lifecycle.<stage>(name)`, and let it depend on services, never on other hooks: order hooks with stages. Rename a key that is not meant as a hook.'

INJECUTE_INVALID_HOOK.title ​

readonly title: "A lifecycle hook is not registered correctly" = 'A lifecycle hook is not registered correctly'

INJECUTE_INVALID_OPTION ​

readonly INJECUTE_INVALID_OPTION: object

INJECUTE_INVALID_OPTION.hint ​

readonly hint: "Transient services are not kept by the container, so they cannot have a dispose option. createTag() and createLifecycle() take unique, non-empty names without \":\" or \".\"; startLifecycle() takes a lifecycle made by createLifecycle() and only its stages in \"concurrent\"." = 'Transient services are not kept by the container, so they cannot have a dispose option. createTag() and createLifecycle() take unique, non-empty names without ":" or "."; startLifecycle() takes a lifecycle made by createLifecycle() and only its stages in "concurrent".'

INJECUTE_INVALID_OPTION.title ​

readonly title: "An option is not supported here" = 'An option is not supported here'

INJECUTE_LIFECYCLE_STOPPED ​

readonly INJECUTE_LIFECYCLE_STOPPED: object

INJECUTE_LIFECYCLE_STOPPED.hint ​

readonly hint: "A lifecycle runs once per container. To start again, create a new container or an isolated fork." = 'A lifecycle runs once per container. To start again, create a new container or an isolated fork.'

INJECUTE_LIFECYCLE_STOPPED.title ​

readonly title: "The lifecycle of this container was stopped" = 'The lifecycle of this container was stopped'

INJECUTE_NAMESPACE_CONFLICT ​

readonly INJECUTE_NAMESPACE_CONFLICT: object

INJECUTE_NAMESPACE_CONFLICT.hint ​

readonly hint: "Choose another namespace name, or remove the service with that key." = 'Choose another namespace name, or remove the service with that key.'

INJECUTE_NAMESPACE_CONFLICT.title ​

readonly title: "The namespace name is already used by a service" = 'The namespace name is already used by a service'

INJECUTE_NAMESPACE_RESULT ​

readonly INJECUTE_NAMESPACE_RESULT: object

INJECUTE_NAMESPACE_RESULT.hint ​

readonly hint: "Return the registry the callback received (after adding services), a fork of it, or a new DIContainer." = 'Return the registry the callback received (after adding services), a fork of it, or a new DIContainer.'

INJECUTE_NAMESPACE_RESULT.title ​

readonly title: "A namespace callback returned something other than a new container" = 'A namespace callback returned something other than a new container'

INJECUTE_NO_PREVIOUS_DEFINITION ​

readonly INJECUTE_NO_PREVIOUS_DEFINITION: object

INJECUTE_NO_PREVIOUS_DEFINITION.hint ​

readonly hint: "A dependency on the key being registered resolves its previous definition (the replaced one, or the parent one). Register the original service first." = 'A dependency on the key being registered resolves its previous definition (the replaced one, or the parent one). Register the original service first.'

INJECUTE_NO_PREVIOUS_DEFINITION.title ​

readonly title: "A service depends on itself but there is nothing to decorate" = 'A service depends on itself but there is nothing to decorate'

INJECUTE_NOT_A_FUNCTION ​

readonly INJECUTE_NOT_A_FUNCTION: object

INJECUTE_NOT_A_FUNCTION.hint ​

readonly hint: "Only function services can be called with call(); use get() for other services." = 'Only function services can be called with call(); use get() for other services.'

INJECUTE_NOT_A_FUNCTION.title ​

readonly title: "call() was used on a service that is not a function" = 'call() was used on a service that is not a function'

INJECUTE_NOT_REGISTERED ​

readonly INJECUTE_NOT_REGISTERED: object

INJECUTE_NOT_REGISTERED.hint ​

readonly hint: "Register it (addSingleton / addTransient / addInstance) before resolving it, check the key for typos, or pass { optional: true } to get undefined instead." = 'Register it (addSingleton / addTransient / addInstance) before resolving it, check the key for typos, or pass { optional: true } to get undefined instead.'

INJECUTE_NOT_REGISTERED.title ​

readonly title: "No service is registered under this key" = 'No service is registered under this key'

INJECUTE_NOTHING_TO_REPLACE ​

readonly INJECUTE_NOTHING_TO_REPLACE: object

INJECUTE_NOTHING_TO_REPLACE.hint ​

readonly hint: "replace: true replaces a registration of this container or a parent. Nothing has this key, which usually means a registration is missing: a module that was not applied, or a typo in the key. Register the original first, or remove replace: true if this is the first registration." = 'replace: true replaces a registration of this container or a parent. Nothing has this key, which usually means a registration is missing: a module that was not applied, or a typo in the key. Register the original first, or remove replace: true if this is the first registration.'

INJECUTE_NOTHING_TO_REPLACE.title ​

readonly title: "A registration replaces a key that nothing is registered under" = 'A registration replaces a key that nothing is registered under'

INJECUTE_READ_ONLY ​

readonly INJECUTE_READ_ONLY: object

INJECUTE_READ_ONLY.hint ​

readonly hint: "Proxy accessors only read services. Register or replace services on the container." = 'Proxy accessors only read services. Register or replace services on the container.'

INJECUTE_READ_ONLY.title ​

readonly title: "The object is read-only" = 'The object is read-only'

INJECUTE_RESOLUTION_FAILED ​

readonly INJECUTE_RESOLUTION_FAILED: object

INJECUTE_RESOLUTION_FAILED.hint ​

readonly hint: "The original error is in `cause`; `path` shows which service needed it." = 'The original error is in `cause`; `path` shows which service needed it.'

INJECUTE_RESOLUTION_FAILED.title ​

readonly title: "A factory threw (or its promise rejected) while creating a service" = 'A factory threw (or its promise rejected) while creating a service'

INJECUTE_SEALED ​

readonly INJECUTE_SEALED: object

INJECUTE_SEALED.hint ​

readonly hint: "Register every service before seal(). To add services later (per request, per test), register them in a fork: app.fork().addInstance(...)." = 'Register every service before seal(). To add services later (per request, per test), register them in a fork: app.fork().addInstance(...).'

INJECUTE_SEALED.title ​

readonly title: "The container is sealed" = 'The container is sealed'

INJECUTE_UNDO_FAILED ​

readonly INJECUTE_UNDO_FAILED: object

INJECUTE_UNDO_FAILED.hint ​

readonly hint: "Its undo function threw, rejected, or did not finish before the stop signal aborted. The hook is in `path`, the original error in `cause`." = 'Its undo function threw, rejected, or did not finish before the stop signal aborted. The hook is in `path`, the original error in `cause`.'

INJECUTE_UNDO_FAILED.title ​

readonly title: "A lifecycle hook could not be undone" = 'A lifecycle hook could not be undone'

INJECUTE_UNKNOWN_EVENT ​

readonly INJECUTE_UNKNOWN_EVENT: object

INJECUTE_UNKNOWN_EVENT.hint ​

readonly hint: "Supported events: add, replace, reset, get, produce, dispose." = 'Supported events: add, replace, reset, get, produce, dispose.'

INJECUTE_UNKNOWN_EVENT.title ​

readonly title: "Unknown event name" = 'Unknown event name'

INJECUTE_WIRING_FAILED ​

readonly INJECUTE_WIRING_FAILED: object

INJECUTE_WIRING_FAILED.hint ​

readonly hint: "Every problem is listed in the message and in error.problems. Register the missing keys (check for typos and for modules that were not applied), and fix the factories that failed: their errors are in each problem and in cause (an AggregateError)." = 'Every problem is listed in the message and in error.problems. Register the missing keys (check for typos and for modules that were not applied), and fix the factories that failed: their errors are in each problem and in cause (an AggregateError).'

INJECUTE_WIRING_FAILED.title ​

readonly title: "The wiring check found services that are missing or fail" = 'The wiring check found services that are missing or fail'

Released under the MIT License.