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

INJECUTE_NO_PREVIOUS_DEFINITION ​

A service depends on itself but there is nothing to decorate.

How to fix it ​

A dependency on the key being registered resolves its previous definition (the replaced one, or the parent one). Register the original service first.

Handling it in code ​

ts
import { InjecuteError } from 'injecute';

try {
  // ...
} catch (error) {
  if (error instanceof InjecuteError && error.code === 'INJECUTE_NO_PREVIOUS_DEFINITION') {
    // error.message explains what happened; error.path is the resolution chain
  }
}

All error codes

Released under the MIT License.