Skip to main content
Version: v0.0.3

Class: NcpdpProfileError

Thrown by defineProfile() and profile-validation code when a profile definition is structurally invalid. Carries the offending profile name (when known) so consumers can pinpoint which definition failed.

Example

import { defineProfile, NcpdpProfileError } from "@cosyte/ncpdp/profiles";
try {
defineProfile({ name: "" });
} catch (err) {
if (err instanceof NcpdpProfileError) {
console.error(err.message, err.profileName);
}
}

Extends

  • Error

Constructors

Constructor

new NcpdpProfileError(message, profileName?): NcpdpProfileError

Internal

Construct a new NcpdpProfileError. profileName is optional so the name validator can throw before a usable name is available.

Parameters

message

string

profileName?

string

Returns

NcpdpProfileError

Overrides

Error.constructor

Properties

profileName

readonly profileName: string | undefined