Skip to content

Commit

Permalink
fix(middleware): use crypto without import
Browse files Browse the repository at this point in the history
  • Loading branch information
aprendendofelipe committed Jul 27, 2024
1 parent e388bc7 commit 1c6864a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions errors/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { randomUUID as uuid } from 'crypto';

class BaseError extends Error {
constructor({
name,
Expand All @@ -20,7 +18,7 @@ class BaseError extends Error {
this.message = message;
this.action = action;
this.statusCode = statusCode || 500;
this.errorId = errorId || uuid();
this.errorId = errorId || crypto.randomUUID();

Check failure on line 21 in errors/index.js

View workflow job for this annotation

GitHub Actions / Tests

Unhandled error

ReferenceError: crypto is not defined ❯ new BaseError errors/index.js:21:31 ❯ new ServiceError errors/index.js:65:5 ❯ Object.logError [as onRetry] infra/email.js:64:25 ❯ onError node_modules/async-retry/lib/index.js:34:17 ❯ catchIt node_modules/async-retry/lib/index.js:51:11 This error originated in "tests/unit/infra/email.test.js" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should throw an error if sending the email fails all attempts". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 21 in errors/index.js

View workflow job for this annotation

GitHub Actions / Tests

Unhandled error

ReferenceError: crypto is not defined ❯ new BaseError errors/index.js:21:31 ❯ new ServiceError errors/index.js:65:5 ❯ Object.logError [as onRetry] infra/email.js:64:25 ❯ onError node_modules/async-retry/lib/index.js:34:17 ❯ catchIt node_modules/async-retry/lib/index.js:51:11 This error originated in "tests/unit/infra/email.test.js" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should retry if sending the email fails once". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 21 in errors/index.js

View workflow job for this annotation

GitHub Actions / Tests

Unhandled error

ReferenceError: crypto is not defined ❯ new BaseError errors/index.js:21:31 ❯ new ServiceError errors/index.js:65:5 ❯ Object.logError [as onRetry] infra/email.js:64:25 ❯ onError node_modules/async-retry/lib/index.js:34:17 ❯ catchIt node_modules/async-retry/lib/index.js:51:11 This error originated in "tests/unit/infra/email.test.js" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should throw an error if sending the email fails all attempts". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 21 in errors/index.js

View workflow job for this annotation

GitHub Actions / Tests

Unhandled error

ReferenceError: crypto is not defined ❯ new BaseError errors/index.js:21:31 ❯ new ServiceError errors/index.js:65:5 ❯ Object.logError [as onRetry] infra/email.js:64:25 ❯ onError node_modules/async-retry/lib/index.js:34:17 ❯ catchIt node_modules/async-retry/lib/index.js:51:11 This error originated in "tests/unit/infra/email.test.js" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should throw an error if sending the email fails all attempts". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 21 in errors/index.js

View workflow job for this annotation

GitHub Actions / Tests

Unhandled error

ReferenceError: crypto is not defined ❯ new BaseError errors/index.js:21:31 ❯ new ServiceError errors/index.js:65:5 ❯ Object.logError [as onRetry] infra/email.js:64:25 ❯ onError node_modules/async-retry/lib/index.js:34:17 ❯ catchIt node_modules/async-retry/lib/index.js:51:11 This error originated in "tests/unit/infra/email.test.js" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should throw an error if sending the email fails all attempts". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.

Check failure on line 21 in errors/index.js

View workflow job for this annotation

GitHub Actions / Tests

Unhandled error

ReferenceError: crypto is not defined ❯ new BaseError errors/index.js:21:31 ❯ new ServiceError errors/index.js:65:5 ❯ Object.logError [as onRetry] infra/email.js:64:25 ❯ onError node_modules/async-retry/lib/index.js:34:17 ❯ catchIt node_modules/async-retry/lib/index.js:51:11 This error originated in "tests/unit/infra/email.test.js" test file. It doesn't mean the error was thrown inside the file itself, but while it was running. The latest test that might've caused the error is "should retry with alternative email service". It might mean one of the following: - The error was thrown, while Vitest was running this test. - If the error occurred after the test had been completed, this was the last documented test before it was thrown.
this.requestId = requestId;
this.context = context;
this.stack = stack;
Expand Down

0 comments on commit 1c6864a

Please sign in to comment.