Skip to content

DI Bag API / index / DiBagPluginValidationError

Class: DiBagPluginValidationError ​

Defined in: errors.ts:59

A plugin descriptor or its acquired output failed validation at the checked plugin boundary.

Example ​

ts
import { DiBag, DiBagPluginValidationError } from 'di-bag';

try {
  DiBag.createProviderFromPlugin({ dependencies: [], pluginDescriptor: { apiVersion: 2 }, factoryReturnKind: 'uninspected', isValidPluginOutput: (pluginOutput): pluginOutput is string => typeof pluginOutput === 'string' });
} catch (error) {
  if (error instanceof DiBagPluginValidationError) console.error(error.phase, error.reason);
}

Extends ​

  • Error

Constructors ​

Constructor ​

ts
new (phase: "descriptor" | "output", reason: string, operation?: "createProviderFromPlugin"): DiBagPluginValidationError;

Defined in: errors.ts:66

Parameters ​

ParameterDescription
phaseWhether descriptor authentication or output validation failed.
reasonA stable description of the rejected boundary condition.
operation-

Overrides ​

ts
Error.constructor

Properties ​

code ​

ts
declare readonly code: 'DI_BAG_PLUGIN_VALIDATION';

Defined in: errors.ts:60


details ​

ts
declare readonly details: Readonly<Record<string, unknown>>;

Defined in: errors.ts:61


phase ​

ts
readonly phase: 'descriptor' | 'output';

Defined in: errors.ts:67

Whether descriptor authentication or output validation failed.


reason ​

ts
readonly reason: string;

Defined in: errors.ts:68

A stable description of the rejected boundary condition.

Ordinary services. Checked composition. Explicit ownership.