adobe / reactor-uploader

Command line tool for uploading Adobe Experience Platform Tags extensions.
Apache License 2.0
9 stars 11 forks source link

Stringify all property of errors #54

Closed mems closed 1 year ago

mems commented 1 year ago

Description

Change how errors objects are stringified. Use all properties, not only enumerable ones.

Related Issue

53

Motivation and Context

Stringify to JSON will omit non enumerable properties by default.

That the case when you try to stringify errors:

JSON.stringify(new Error("message", {cause: new Error("message 2")})) === "{}";

Example of the current output when upload a package when a more recent package was already uploaded:

$ npx @adobe/reactor-uploader "$PACKAGE_PATH" --org-id="$ORGANIZATION_ID" --private-key="$PRIVATE_KEY" --tech-account-id="$TECHNICAL_ACCOUNT_ID" --api-key="$API_KEY" --client-secret="$CLIENT_SECRET"
No development extension package was found on the server with the name [REDACTED]. A new extension package will be created.
--verbose output:
[REDACTED]/node_modules/@adobe/reactor-uploader/bin/handleResponseError.js:29
  throw new Error(messagePrefix + ' ' + message);
        ^
Error: Error uploading extension package. An unknown error occurred: {}.
    at module.exports ([REDACTED]/node_modules/@adobe/reactor-uploader/bin/handleResponseError.js:29:9)
    at module.exports ([REDACTED]/node_modules/@adobe/reactor-uploader/bin/uploadZip.js:71:5)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async [REDACTED]/node_modules/@adobe/reactor-uploader/bin/index.js:82:32

How Has This Been Tested?

With npm test in codespace

Types of changes

Checklist:

brenthosie commented 1 year ago

Thank you for the contribution!