Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ot-builder/errors

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ot-builder/errors - npm Package Compare versions

Comparing version
1.0.11
to
1.1.0
+4
lib/asserts.d.ts
export * as Cff from "./asserts/cff";
export * from "./asserts/common";
export * as Variation from "./asserts/variation";
//# sourceMappingURL=asserts.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Variation = exports.Cff = void 0;
const tslib_1 = require("tslib");
exports.Cff = require("./asserts/cff");
tslib_1.__exportStar(require("./asserts/common"), exports);
exports.Variation = require("./asserts/variation");
//# sourceMappingURL=asserts.js.map
export declare const OnlyOneTopDictAllowed: <A>(a: A[]) => void;
//# sourceMappingURL=cff.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OnlyOneTopDictAllowed = void 0;
const OnlyOneTopDictAllowed = (a) => {
if (a.length !== 1)
throw new RangeError("Only one top dict is allowed in OpenType");
};
exports.OnlyOneTopDictAllowed = OnlyOneTopDictAllowed;
//# sourceMappingURL=cff.js.map
export declare const VersionSupported: (kind1: string, actual: number, ...expected: number[]) => void;
export declare const SubVersionSupported: (kind1: string, major: number, minor: number, ...expected: [number, number][]) => void;
export declare const FormatSupported: (kind1: string, actual: number, ...expected: number[]) => void;
export declare const SizeMatch: (kind1: string, actual: number, ...expected: number[]) => void;
export declare const OffsetMatch: (kind1: string, actual: number, ...expected: number[]) => void;
export declare const NotOverflow: (kind1: string, actual: number, limit: number) => void;
export declare function NoGap<A>(kind: string, arr: readonly A[]): void;
//# sourceMappingURL=common.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoGap = exports.NotOverflow = exports.OffsetMatch = exports.SizeMatch = exports.FormatSupported = exports.SubVersionSupported = exports.VersionSupported = void 0;
const Errors = require("../errors");
const VersionSupported = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.VersionNotSupported(kind1, actual);
};
exports.VersionSupported = VersionSupported;
const SubVersionSupported = (kind1, major, minor, ...expected) => {
for (const [eMaj, eMin] of expected)
if (major === eMaj && minor === eMin)
return;
throw Errors.VersionNotSupported(kind1, `${major}.${minor}`);
};
exports.SubVersionSupported = SubVersionSupported;
const FormatSupported = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.FormatNotSupported(kind1, actual, ...expected);
};
exports.FormatSupported = FormatSupported;
const SizeMatch = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.SizeMismatch(kind1, actual, ...expected);
};
exports.SizeMatch = SizeMatch;
const OffsetMatch = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.OffsetMismatch(kind1, actual, ...expected);
};
exports.OffsetMatch = OffsetMatch;
const NotOverflow = (kind1, actual, limit) => {
if (actual < limit)
return;
throw Errors.OffsetMismatch(kind1, actual);
};
exports.NotOverflow = NotOverflow;
function NoGap(kind, arr) {
for (let index = 0; index < arr.length; index++) {
if (arr[index] === undefined)
throw new TypeError(`Gap found in array ${kind}`);
}
}
exports.NoGap = NoGap;
//# sourceMappingURL=common.js.map
export declare const AxesCountMatch: (kind1: string, actual: number, kind2: string, expected: number) => void;
//# sourceMappingURL=variation.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AxesCountMatch = void 0;
const AxesCountMatch = (kind1, actual, kind2, expected) => {
if (actual !== expected) {
throw new TypeError(`Axis count mismatch : ${kind1} ${actual} <> ${kind2} ${expected}`);
}
};
exports.AxesCountMatch = AxesCountMatch;
//# sourceMappingURL=variation.js.map
export * from "./errors/common";
export * as Binary from "./errors/binary";
export * as Primitives from "./errors/primitives";
export * as Variation from "./errors/variation";
export * as Fvar from "./errors/fvar";
export * as Post from "./errors/post";
export * as Cff from "./errors/cff";
export * as Ttf from "./errors/ttf";
export * as Layout from "./errors/layout";
export * as Name from "./errors/name";
export * as STAT from "./errors/stat";
export * as Avar from "./errors/avar";
//# sourceMappingURL=errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Avar = exports.STAT = exports.Name = exports.Layout = exports.Ttf = exports.Cff = exports.Post = exports.Fvar = exports.Variation = exports.Primitives = exports.Binary = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./errors/common"), exports);
exports.Binary = require("./errors/binary");
exports.Primitives = require("./errors/primitives");
exports.Variation = require("./errors/variation");
exports.Fvar = require("./errors/fvar");
exports.Post = require("./errors/post");
exports.Cff = require("./errors/cff");
exports.Ttf = require("./errors/ttf");
exports.Layout = require("./errors/layout");
exports.Name = require("./errors/name");
exports.STAT = require("./errors/stat");
exports.Avar = require("./errors/avar");
//# sourceMappingURL=errors.js.map
export declare const MissingMapping: (tag: string) => TypeError;
//# sourceMappingURL=avar.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MissingMapping = void 0;
const MissingMapping = (tag) => new TypeError(`Missing AVAR mapping for ${tag}`);
exports.MissingMapping = MissingMapping;
//# sourceMappingURL=avar.js.map
export declare const PointerUnderflow: () => Error;
export declare const UnresolvableFragOverflow: () => Error;
export declare const UnknownPointerType: () => TypeError;
//# sourceMappingURL=binary.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnknownPointerType = exports.UnresolvableFragOverflow = exports.PointerUnderflow = void 0;
const PointerUnderflow = () => new Error("Critical! Unreachable: Pointer underflow");
exports.PointerUnderflow = PointerUnderflow;
const UnresolvableFragOverflow = () => new Error("Unresolvable pointer flow happened during packing binary fragments");
exports.UnresolvableFragOverflow = UnresolvableFragOverflow;
const UnknownPointerType = () => new TypeError("Unknown pointer type");
exports.UnknownPointerType = UnknownPointerType;
//# sourceMappingURL=binary.js.map
export declare const OperatorNotSupported: (opCode: number) => TypeError;
export declare const StackInsufficient: (actual: number, expected: number) => RangeError;
export declare const NotVariable: () => RangeError;
export declare const FdSelectSentinelMismatch: (actual: number, expected: number) => RangeError;
export declare const FdSelect4NotSupported: () => TypeError;
export declare const FdIdOverflow: (actual: number, limit: number) => RangeError;
export declare const TransientInvalid: (index: number) => TypeError;
export declare const SubroutineNotFound: (kind: string, index: number) => RangeError;
export declare const StringsDisallowed: () => TypeError;
export declare const ShouldHaveStrings: () => TypeError;
export declare const MissingPrivateDict: (fdId: number) => Error;
export declare const ShouldHaveFdArray: () => Error;
export declare const UnknownToken: () => TypeError;
export declare const ReferencesNotSupported: () => TypeError;
//# sourceMappingURL=cff.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReferencesNotSupported = exports.UnknownToken = exports.ShouldHaveFdArray = exports.MissingPrivateDict = exports.ShouldHaveStrings = exports.StringsDisallowed = exports.SubroutineNotFound = exports.TransientInvalid = exports.FdIdOverflow = exports.FdSelect4NotSupported = exports.FdSelectSentinelMismatch = exports.NotVariable = exports.StackInsufficient = exports.OperatorNotSupported = void 0;
const OperatorNotSupported = (opCode) => new TypeError(`OpCode 0x${opCode.toString(16)} is not supported here`);
exports.OperatorNotSupported = OperatorNotSupported;
const StackInsufficient = (actual, expected) => new RangeError(`Stack height insufficient: Expected ${expected}, Actual ${actual}`);
exports.StackInsufficient = StackInsufficient;
const NotVariable = () => new RangeError(`Cannot use variation here`);
exports.NotVariable = NotVariable;
const FdSelectSentinelMismatch = (actual, expected) => new RangeError(`FDSelect sentinel mismatch: ${actual} ~ ${expected}`);
exports.FdSelectSentinelMismatch = FdSelectSentinelMismatch;
const FdSelect4NotSupported = () => new TypeError("This font requires format 4 FDSelect, but it is not supported in CFF version 1.");
exports.FdSelect4NotSupported = FdSelect4NotSupported;
const FdIdOverflow = (actual, limit) => new RangeError(`FDSelect FD Id overflow: ${actual} >= ${limit}`);
exports.FdIdOverflow = FdIdOverflow;
const TransientInvalid = (index) => new TypeError("Transient[" + index + "] is invalid.");
exports.TransientInvalid = TransientInvalid;
const SubroutineNotFound = (kind, index) => new RangeError(`CFF subroutine not found: ${kind} ${index}`);
exports.SubroutineNotFound = SubroutineNotFound;
const StringsDisallowed = () => new TypeError("Cannot use string in newer CFF version");
exports.StringsDisallowed = StringsDisallowed;
const ShouldHaveStrings = () => new TypeError("Unreachable. Should support strings.");
exports.ShouldHaveStrings = ShouldHaveStrings;
const MissingPrivateDict = (fdId) => new Error(`Private dict missing for FD ${fdId}`);
exports.MissingPrivateDict = MissingPrivateDict;
const ShouldHaveFdArray = () => new Error(`FDArray should be present`);
exports.ShouldHaveFdArray = ShouldHaveFdArray;
const UnknownToken = () => new TypeError("Unrecognized token type");
exports.UnknownToken = UnknownToken;
const ReferencesNotSupported = () => new TypeError("CFF does not support references.");
exports.ReferencesNotSupported = ReferencesNotSupported;
//# sourceMappingURL=cff.js.map
export declare const Unreachable: () => Error;
export declare const NullPtr: (reason?: string | undefined) => TypeError;
export declare const FormatNotSupported: (what: string, ver: number | string, ...expected: (number | string)[]) => TypeError;
export declare const VersionNotSupported: (what: string, ver: number | string) => TypeError;
export declare const SizeMismatch: (what: string, actual: number, ...expected: number[]) => TypeError;
export declare const OffsetMismatch: (what: string, actual: number, ...expected: number[]) => TypeError;
export declare const MissingKeyTable: (tag: string) => TypeError;
export declare const GeneralOverflow: (kind: string, value: number) => RangeError;
export declare const GlyphNotFound: (where: string) => RangeError;
export declare const GlyphCountMismatch: (where: string) => RangeError;
//# sourceMappingURL=common.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlyphCountMismatch = exports.GlyphNotFound = exports.GeneralOverflow = exports.MissingKeyTable = exports.OffsetMismatch = exports.SizeMismatch = exports.VersionNotSupported = exports.FormatNotSupported = exports.NullPtr = exports.Unreachable = void 0;
const Unreachable = () => new Error("Unreachable");
exports.Unreachable = Unreachable;
const NullPtr = (reason) => new TypeError(`Null pointer detected${reason ? " : " + reason : ""}`);
exports.NullPtr = NullPtr;
const FormatNotSupported = (what, ver, ...expected) => new TypeError(`${what} format unsupported : ${ver} (Expected: ${expected})`);
exports.FormatNotSupported = FormatNotSupported;
const VersionNotSupported = (what, ver) => new TypeError(`${what} version unsupported : ${ver}`);
exports.VersionNotSupported = VersionNotSupported;
const SizeMismatch = (what, actual, ...expected) => new TypeError(`${what} size mismatch : ${actual} (Expected: ${expected})`);
exports.SizeMismatch = SizeMismatch;
const OffsetMismatch = (what, actual, ...expected) => new TypeError(`${what} offset mismatch : ${expected} (Expected: ${expected})`);
exports.OffsetMismatch = OffsetMismatch;
const MissingKeyTable = (tag) => new TypeError(`Table ${tag} missing.`);
exports.MissingKeyTable = MissingKeyTable;
const GeneralOverflow = (kind, value) => new RangeError(`${kind} overflow: ${value}.`);
exports.GeneralOverflow = GeneralOverflow;
const GlyphNotFound = (where) => new RangeError(`Glyph not found in ${where}`);
exports.GlyphNotFound = GlyphNotFound;
const GlyphCountMismatch = (where) => new RangeError(`Glyph count mismatch at ${where}`);
exports.GlyphCountMismatch = GlyphCountMismatch;
//# sourceMappingURL=common.js.map
export declare const MixedPostScriptNamePresence: () => Error;
//# sourceMappingURL=fvar.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MixedPostScriptNamePresence = void 0;
const MixedPostScriptNamePresence = () => new Error("fvar::InstanceRecord::postScriptNameID presence mixed across instances");
exports.MixedPostScriptNamePresence = MixedPostScriptNamePresence;
//# sourceMappingURL=fvar.js.map
export declare const EmptyExtensionLookup: () => TypeError;
//# sourceMappingURL=layout.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmptyExtensionLookup = void 0;
const EmptyExtensionLookup = () => new TypeError("Extension lookup have no subtables. Cannot decide lookup type.");
exports.EmptyExtensionLookup = EmptyExtensionLookup;
//# sourceMappingURL=layout.js.map
export declare const EncodingNotSupported: (platformID: number, encodingID: number) => TypeError;
//# sourceMappingURL=name.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncodingNotSupported = void 0;
const EncodingNotSupported = (platformID, encodingID) => new TypeError(`Name encoding not supported for platform ${platformID} : ${encodingID}`);
exports.EncodingNotSupported = EncodingNotSupported;
//# sourceMappingURL=name.js.map
export declare const MissingName: (gid: number | string) => Error;
//# sourceMappingURL=post.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MissingName = void 0;
const MissingName = (gid) => new Error(`Glyph name undefined for glyph #${gid}`);
exports.MissingName = MissingName;
//# sourceMappingURL=post.js.map
export declare const UnsupportedIntSize: () => TypeError;
//# sourceMappingURL=primitives.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnsupportedIntSize = void 0;
const UnsupportedIntSize = () => new TypeError("Unsupported integer size");
exports.UnsupportedIntSize = UnsupportedIntSize;
//# sourceMappingURL=primitives.js.map
export declare const UnknownAxisValueFormat: () => TypeError;
//# sourceMappingURL=stat.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnknownAxisValueFormat = void 0;
const UnknownAxisValueFormat = () => new TypeError(`Unknown axis value format`);
exports.UnknownAxisValueFormat = UnknownAxisValueFormat;
//# sourceMappingURL=stat.js.map
export declare const MixedGlyph: (gid: number) => TypeError;
export declare const MissingSharedTuples: () => Error;
export declare const InvalidPointAttachment: (zOut: number, zIn: number) => Error;
//# sourceMappingURL=ttf.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidPointAttachment = exports.MissingSharedTuples = exports.MixedGlyph = void 0;
const MixedGlyph = (gid) => new TypeError(`Cannot classify glyph#${gid}. May be a mixed glyph.`);
exports.MixedGlyph = MixedGlyph;
const MissingSharedTuples = () => new Error("GVARHeader->SharedTuples record not exist.");
exports.MissingSharedTuples = MissingSharedTuples;
const InvalidPointAttachment = (zOut, zIn) => new Error(`Invalid point attachment ${zOut} >< ${zIn}.`);
exports.InvalidPointAttachment = InvalidPointAttachment;
//# sourceMappingURL=ttf.js.map
export declare const IndexOverflow: (kind: string, index: number) => RangeError;
export declare const NoAxes: () => Error;
export declare const MissingPoints: () => Error;
export declare const MissingPeakTuple: () => Error;
export declare const TooManyMasters: () => RangeError;
//# sourceMappingURL=variation.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TooManyMasters = exports.MissingPeakTuple = exports.MissingPoints = exports.NoAxes = exports.IndexOverflow = void 0;
const IndexOverflow = (kind, index) => new RangeError(`Index ${kind} overflow: ${index}`);
exports.IndexOverflow = IndexOverflow;
const NoAxes = () => new Error(`No axes found in font`);
exports.NoAxes = NoAxes;
const MissingPoints = () => new Error(`No point list defined`);
exports.MissingPoints = MissingPoints;
const MissingPeakTuple = () => new Error(`Cannot find peak tuple`);
exports.MissingPeakTuple = MissingPeakTuple;
const TooManyMasters = () => new RangeError("Too many masters are involved");
exports.TooManyMasters = TooManyMasters;
//# sourceMappingURL=variation.js.map
+22
-1

@@ -5,3 +5,24 @@ {

{
"date": "Sat, 17 Jul 2021 01:05:36 GMT",
"date": "Sun, 18 Jul 2021 02:11:53 GMT",
"tag": "@ot-builder/errors_v1.1.0",
"version": "1.1.0",
"comments": {
"minor": [
{
"comment": "Cleanup unnecessary namespaces",
"author": "otbbuilder-dev@users.noreply.github.com",
"commit": "c79ab97437319873bfe49602a21eab95d78083e3",
"package": "@ot-builder/errors"
},
{
"comment": "Bump @ot-builder/errors to v1.1.0",
"author": "otbbuilder-dev@users.noreply.github.com",
"commit": "c79ab97437319873bfe49602a21eab95d78083e3",
"package": "@ot-builder/errors"
}
]
}
},
{
"date": "Sat, 17 Jul 2021 01:08:07 GMT",
"tag": "@ot-builder/errors_v1.0.11",

@@ -8,0 +29,0 @@ "version": "1.0.11",

# Change Log - @ot-builder/errors
This log was last generated on Sat, 17 Jul 2021 01:05:36 GMT and should not be manually modified.
This log was last generated on Sun, 18 Jul 2021 02:11:53 GMT and should not be manually modified.
<!-- Start content -->
## 1.1.0
Sun, 18 Jul 2021 02:11:53 GMT
### Minor changes
- Cleanup unnecessary namespaces (otbbuilder-dev@users.noreply.github.com)
- Bump @ot-builder/errors to v1.1.0 (otbbuilder-dev@users.noreply.github.com)
## 1.0.11
Sat, 17 Jul 2021 01:05:36 GMT
Sat, 17 Jul 2021 01:08:07 GMT

@@ -11,0 +20,0 @@ ### Patches

+2
-81

@@ -1,82 +0,3 @@

export declare namespace Errors {
const Unreachable: () => Error;
const NullPtr: (reason?: string | undefined) => TypeError;
const FormatNotSupported: (what: string, ver: number | string, ...expected: (number | string)[]) => TypeError;
const VersionNotSupported: (what: string, ver: number | string) => TypeError;
const SizeMismatch: (what: string, actual: number, ...expected: number[]) => TypeError;
const OffsetMismatch: (what: string, actual: number, ...expected: number[]) => TypeError;
const MissingKeyTable: (tag: string) => TypeError;
const GeneralOverflow: (kind: string, value: number) => RangeError;
const GlyphNotFound: (where: string) => RangeError;
const GlyphCountMismatch: (where: string) => RangeError;
namespace Binary {
const PointerUnderflow: () => Error;
const UnresolvableFragOverflow: () => Error;
const UnknownPointerType: () => TypeError;
}
namespace Primitives {
const UnsupportedIntSize: () => TypeError;
}
namespace Variation {
const IndexOverflow: (kind: string, index: number) => RangeError;
const NoAxes: () => Error;
const MissingPoints: () => Error;
const MissingPeakTuple: () => Error;
const TooManyMasters: () => RangeError;
}
namespace Fvar {
const MixedPostScriptNamePresence: () => Error;
}
namespace Post {
const MissingName: (gid: number | string) => Error;
}
namespace Cff {
const OperatorNotSupported: (opCode: number) => TypeError;
const StackInsufficient: (actual: number, expected: number) => RangeError;
const NotVariable: () => RangeError;
const FdSelectSentinelMismatch: (actual: number, expected: number) => RangeError;
const FdSelect4NotSupported: () => TypeError;
const FdIdOverflow: (actual: number, limit: number) => RangeError;
const TransientInvalid: (index: number) => TypeError;
const SubroutineNotFound: (kind: string, index: number) => RangeError;
const StringsDisallowed: () => TypeError;
const ShouldHaveStrings: () => TypeError;
const MissingPrivateDict: (fdId: number) => Error;
const ShouldHaveFdArray: () => Error;
const UnknownToken: () => TypeError;
const ReferencesNotSupported: () => TypeError;
}
namespace Ttf {
const MixedGlyph: (gid: number) => TypeError;
const MissingSharedTuples: () => Error;
const InvalidPointAttachment: (zOut: number, zIn: number) => Error;
}
namespace Layout {
const EmptyExtensionLookup: () => TypeError;
}
namespace Name {
const EncodingNotSupported: (platformID: number, encodingID: number) => TypeError;
}
namespace STAT {
const UnknownAxisValueFormat: () => TypeError;
}
namespace Avar {
const MissingMapping: (tag: string) => TypeError;
}
}
export declare namespace Assert {
const VersionSupported: (kind1: string, actual: number, ...expected: number[]) => void;
const SubVersionSupported: (kind1: string, major: number, minor: number, ...expected: [number, number][]) => void;
const FormatSupported: (kind1: string, actual: number, ...expected: number[]) => void;
const SizeMatch: (kind1: string, actual: number, ...expected: number[]) => void;
const OffsetMatch: (kind1: string, actual: number, ...expected: number[]) => void;
const NotOverflow: (kind1: string, actual: number, limit: number) => void;
function NoGap<A>(kind: string, arr: readonly A[]): void;
namespace Variation {
const AxesCountMatch: (kind1: string, actual: number, kind2: string, expected: number) => void;
}
namespace Cff {
const OnlyOneTopDictAllowed: <A>(a: A[]) => void;
}
}
export * as Assert from "./asserts";
export * as Errors from "./errors";
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Assert = exports.Errors = void 0;
var Errors;
(function (Errors) {
Errors.Unreachable = () => new Error("Unreachable");
Errors.NullPtr = (reason) => new TypeError(`Null pointer detected${reason ? " : " + reason : ""}`);
Errors.FormatNotSupported = (what, ver, ...expected) => new TypeError(`${what} format unsupported : ${ver} (Expected: ${expected})`);
Errors.VersionNotSupported = (what, ver) => new TypeError(`${what} version unsupported : ${ver}`);
Errors.SizeMismatch = (what, actual, ...expected) => new TypeError(`${what} size mismatch : ${actual} (Expected: ${expected})`);
Errors.OffsetMismatch = (what, actual, ...expected) => new TypeError(`${what} offset mismatch : ${expected} (Expected: ${expected})`);
Errors.MissingKeyTable = (tag) => new TypeError(`Table ${tag} missing.`);
Errors.GeneralOverflow = (kind, value) => new RangeError(`${kind} overflow: ${value}.`);
Errors.GlyphNotFound = (where) => new RangeError(`Glyph not found in ${where}`);
Errors.GlyphCountMismatch = (where) => new RangeError(`Glyph count mismatch at ${where}`);
let Binary;
(function (Binary) {
Binary.PointerUnderflow = () => new Error("Critical! Unreachable: Pointer underflow");
Binary.UnresolvableFragOverflow = () => new Error("Unresolvable pointer flow happened during packing binary fragments");
Binary.UnknownPointerType = () => new TypeError("Unknown pointer type");
})(Binary = Errors.Binary || (Errors.Binary = {}));
let Primitives;
(function (Primitives) {
Primitives.UnsupportedIntSize = () => new TypeError("Unsupported integer size");
})(Primitives = Errors.Primitives || (Errors.Primitives = {}));
let Variation;
(function (Variation) {
Variation.IndexOverflow = (kind, index) => new RangeError(`Index ${kind} overflow: ${index}`);
Variation.NoAxes = () => new Error(`No axes found in font`);
Variation.MissingPoints = () => new Error(`No point list defined`);
Variation.MissingPeakTuple = () => new Error(`Cannot find peak tuple`);
Variation.TooManyMasters = () => new RangeError("Too many masters are involved");
})(Variation = Errors.Variation || (Errors.Variation = {}));
let Fvar;
(function (Fvar) {
Fvar.MixedPostScriptNamePresence = () => new Error("fvar::InstanceRecord::postScriptNameID presence mixed across instances");
})(Fvar = Errors.Fvar || (Errors.Fvar = {}));
let Post;
(function (Post) {
Post.MissingName = (gid) => new Error(`Glyph name undefined for glyph #${gid}`);
})(Post = Errors.Post || (Errors.Post = {}));
let Cff;
(function (Cff) {
Cff.OperatorNotSupported = (opCode) => new TypeError(`OpCode 0x${opCode.toString(16)} is not supported here`);
Cff.StackInsufficient = (actual, expected) => new RangeError(`Stack height insufficient: Expected ${expected}, Actual ${actual}`);
Cff.NotVariable = () => new RangeError(`Cannot use variation here`);
Cff.FdSelectSentinelMismatch = (actual, expected) => new RangeError(`FDSelect sentinel mismatch: ${actual} ~ ${expected}`);
Cff.FdSelect4NotSupported = () => new TypeError("This font requires format 4 FDSelect, but it is not supported in CFF version 1.");
Cff.FdIdOverflow = (actual, limit) => new RangeError(`FDSelect FD Id overflow: ${actual} >= ${limit}`);
Cff.TransientInvalid = (index) => new TypeError("Transient[" + index + "] is invalid.");
Cff.SubroutineNotFound = (kind, index) => new RangeError(`CFF subroutine not found: ${kind} ${index}`);
Cff.StringsDisallowed = () => new TypeError("Cannot use string in newer CFF version");
Cff.ShouldHaveStrings = () => new TypeError("Unreachable. Should support strings.");
Cff.MissingPrivateDict = (fdId) => new Error(`Private dict missing for FD ${fdId}`);
Cff.ShouldHaveFdArray = () => new Error(`FDArray should be present`);
Cff.UnknownToken = () => new TypeError("Unrecognized token type");
Cff.ReferencesNotSupported = () => new TypeError("CFF does not support references.");
})(Cff = Errors.Cff || (Errors.Cff = {}));
let Ttf;
(function (Ttf) {
Ttf.MixedGlyph = (gid) => new TypeError(`Cannot classify glyph#${gid}. May be a mixed glyph.`);
Ttf.MissingSharedTuples = () => new Error("GVARHeader->SharedTuples record not exist.");
Ttf.InvalidPointAttachment = (zOut, zIn) => new Error(`Invalid point attachment ${zOut} >< ${zIn}.`);
})(Ttf = Errors.Ttf || (Errors.Ttf = {}));
let Layout;
(function (Layout) {
Layout.EmptyExtensionLookup = () => new TypeError("Extension lookup have no subtables. Cannot decide lookup type.");
})(Layout = Errors.Layout || (Errors.Layout = {}));
let Name;
(function (Name) {
Name.EncodingNotSupported = (platformID, encodingID) => new TypeError(`Name encoding not supported for platform ${platformID} : ${encodingID}`);
})(Name = Errors.Name || (Errors.Name = {}));
let STAT;
(function (STAT) {
STAT.UnknownAxisValueFormat = () => new TypeError(`Unknown axis value format`);
})(STAT = Errors.STAT || (Errors.STAT = {}));
let Avar;
(function (Avar) {
Avar.MissingMapping = (tag) => new TypeError(`Missing AVAR mapping for ${tag}`);
})(Avar = Errors.Avar || (Errors.Avar = {}));
})(Errors = exports.Errors || (exports.Errors = {}));
var Assert;
(function (Assert) {
Assert.VersionSupported = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.VersionNotSupported(kind1, actual);
};
Assert.SubVersionSupported = (kind1, major, minor, ...expected) => {
for (const [eMaj, eMin] of expected)
if (major === eMaj && minor === eMin)
return;
throw Errors.VersionNotSupported(kind1, `${major}.${minor}`);
};
Assert.FormatSupported = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.FormatNotSupported(kind1, actual, ...expected);
};
Assert.SizeMatch = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.SizeMismatch(kind1, actual, ...expected);
};
Assert.OffsetMatch = (kind1, actual, ...expected) => {
for (const x of expected)
if (actual === x)
return;
throw Errors.OffsetMismatch(kind1, actual, ...expected);
};
Assert.NotOverflow = (kind1, actual, limit) => {
if (actual < limit)
return;
throw Errors.OffsetMismatch(kind1, actual);
};
function NoGap(kind, arr) {
for (let index = 0; index < arr.length; index++) {
if (arr[index] === undefined)
throw new TypeError(`Gap found in array ${kind}`);
}
}
Assert.NoGap = NoGap;
let Variation;
(function (Variation) {
Variation.AxesCountMatch = (kind1, actual, kind2, expected) => {
if (actual !== expected) {
throw new TypeError(`Axis count mismatch : ${kind1} ${actual} <> ${kind2} ${expected}`);
}
};
})(Variation = Assert.Variation || (Assert.Variation = {}));
let Cff;
(function (Cff) {
Cff.OnlyOneTopDictAllowed = (a) => {
if (a.length !== 1)
throw new RangeError("Only one top dict is allowed in OpenType");
};
})(Cff = Assert.Cff || (Assert.Cff = {}));
})(Assert = exports.Assert || (exports.Assert = {}));
exports.Errors = exports.Assert = void 0;
exports.Assert = require("./asserts");
exports.Errors = require("./errors");
//# sourceMappingURL=index.js.map
{
"name": "@ot-builder/errors",
"description": "",
"version": "1.0.11",
"version": "1.1.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "./lib/index.js",