Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning for ServerError #4

Open
TobiaszCudnik opened this issue Jan 18, 2021 · 0 comments
Open

UnhandledPromiseRejectionWarning for ServerError #4

TobiaszCudnik opened this issue Jan 18, 2021 · 0 comments
Assignees

Comments

@TobiaszCudnik
Copy link
Contributor

Even when everything is wrapped in a try-catch clause, in case of a request error (eg ServerError), one will get an UnhandledPromiseRejectionWarning.

Reproduction:

import { Client } from "@automationcloud/client";

async function main() {
  try {
    const client = new Client({
      serviceId: "12345",
      auth: "12345",
    });
    const job = await client.createJob();
    const [output1] = await job.waitForOutputs("finalPrice");
    await job.submitInput("finalPriceConsent", output1);
    await job.waitForCompletion();
  } catch {
    console.log("fail");
  }
}

main();

Result:

(node:3444473) UnhandledPromiseRejectionWarning: ServerError: ServerError
    at Job._track (./node_modules/@automationcloud/client/out/main/job.js:359:31)
        -> ./node_modules/@automationcloud/client/src/main/job.ts:387:31
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)
(node:3444473) ServerError: ServerError
    at Job._track (./node_modules/@automationcloud/client/out/main/job.js:359:31)
        -> ./node_modules/@automationcloud/client/src/main/job.ts:387:31
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:3444473) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)
@TobiaszCudnik TobiaszCudnik self-assigned this Jan 19, 2021
@TobiaszCudnik TobiaszCudnik changed the title UnhandledPromiseRejectionWarning within a try-catch clause UnhandledPromiseRejectionWarning for ServerError Jan 19, 2021
@inca inca assigned inca and TobiaszCudnik and unassigned TobiaszCudnik Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants