UNPKG

armpit

Version:

Another resource manager programming interface toolkit.

41 lines 1.74 kB
export class ExistingGroupLocationConflictError extends Error { groupName; expectedLocation; actualLocation; constructor(actualOrName, secondArg, thirdArg) { let groupName = "unknown"; let actualLocation = "unknown"; let expectedLocation = "unknown"; if (typeof actualOrName === "string") { groupName = actualOrName; actualLocation = typeof secondArg === "string" ? secondArg : "unknown"; expectedLocation = typeof thirdArg == "string" ? thirdArg : "unknown"; } else if ("name" in actualOrName && typeof actualOrName.name === "string") { groupName = actualOrName.name; actualLocation = typeof actualOrName.location === "string" ? actualOrName.location : "unknown"; expectedLocation = typeof secondArg == "string" ? secondArg : "unknown"; } super(`Existing group ${groupName} in ${actualLocation} conflicts with expected location ${expectedLocation}`); this.groupName = groupName; this.actualLocation = actualLocation; this.expectedLocation = expectedLocation; } } export class GroupNotEmptyError extends Error { static buildMessage(name, resources) { let message = `Group ${name ?? "unknown"} not empty.`; if (resources && resources.length > 0) { message += " Contains resources: " + resources.map(r => r.name ?? r.id ?? "unknown").join(", "); } return message; } groupName; resources; constructor(name, resources) { super(GroupNotEmptyError.buildMessage(name, resources)); this.groupName = name; this.resources = resources; } } //# sourceMappingURL=errors.js.map