From 290c72d6b572ea80d6898ffb829174e20d1d039c Mon Sep 17 00:00:00 2001 From: vapormusic Date: Tue, 1 Mar 2022 22:03:40 +0700 Subject: [PATCH] fix macos build --- .github/workflows/build-macos.yml | 1 + resources/verror-types | 77 +++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 resources/verror-types diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 5f72d294..f1befd57 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -92,6 +92,7 @@ jobs: rm cider-yarn.lock || true xcodebuild -version yarn install + cp resources/verror-types node_modules/@types/verror/index.d.ts cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js yarn dist:universalNotWorking -p never # - name: Perform CodeQL Analysis diff --git a/resources/verror-types b/resources/verror-types new file mode 100644 index 00000000..07cfb21d --- /dev/null +++ b/resources/verror-types @@ -0,0 +1,77 @@ +// Type definitions for verror 1.10 +// Project: https://github.com/davepacheco/node-verror +// Definitions by: Sven Reglitzki , Maxime Toumi-M +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/* + * VError([cause], fmt[, arg...]): Like JavaScript's built-in Error class, but + * supports a "cause" argument (another error) and a printf-style message. The + * cause argument can be null or omitted entirely. + * + * Examples: + * + * CODE MESSAGE + * new VError('something bad happened') "something bad happened" + * new VError('missing file: "%s"', file) "missing file: "/etc/passwd" + * with file = '/etc/passwd' + * new VError(err, 'open failed') "open failed: file not found" + * with err.message = 'file not found' + */ +declare class VError extends Error { + static VError: typeof VError; + + static cause(err: Error): Error | null; + static info(err: Error): VError.Info; + static fullStack(err: Error): string; + static findCauseByName(err: Error, name: string): Error | null; + static hasCauseWithName(err: Error, name: string): boolean; + static errorFromList(errors: T[]): null | T | VError.MultiError; + static errorForEach(err: Error, func: (err: Error) => void): void; + + //@ts-ignore + cause(): Error | undefined; + constructor(options: VError.Options | Error, message: string, ...params: any[]); + constructor(message?: string, ...params: any[]); +} + +declare namespace VError { + interface Info { + [key: string]: any; + } + + interface Options { + cause?: Error | null | undefined; + name?: string | undefined; + strict?: boolean | undefined; + constructorOpt?(...args: any[]): void; + info?: Info | undefined; + } + + /* + * SError is like VError, but stricter about types. You cannot pass "null" or + * "undefined" as string arguments to the formatter. Since SError is only a + * different function, not really a different class, we don't set + * SError.prototype.name. + */ + class SError extends VError {} + + /* + * Represents a collection of errors for the purpose of consumers that generally + * only deal with one error. Callers can extract the individual errors + * contained in this object, but may also just treat it as a normal single + * error, in which case a summary message will be printed. + */ + class MultiError extends VError { + constructor(errors: Error[]); + errors(): Error[]; + } + + /* + * Like JavaScript's built-in Error class, but supports a "cause" argument which + * is wrapped, not "folded in" as with VError. Accepts a printf-style message. + * The cause argument can be null. + */ + class WError extends VError {} +} + +export = VError; \ No newline at end of file