Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
This reverts a0f1abe. As it turns out ErrnoException was used on purpose, because that type includes the `code` property.

A comment was added in order to make this more clear.
  • Loading branch information
ComradeVanti committed Dec 20, 2023
1 parent a03fcb0 commit 2387f9d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/error-type-guards.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { HttpErrorBase } from "npm-registry-fetch";
import { AssertionError } from "assert";

/*
* Note: We are in a Node context, where Errors have the "code" property.
* We need to make sure we use Node's error type instead of the default one
* @see https://dev.to/jdbar/the-problem-with-handling-node-js-errors-in-typescript-and-the-workaround-m64
*/
import Error = NodeJS.ErrnoException;

/**
* @throws AssertionError The given parameter is not an error
Expand Down

0 comments on commit 2387f9d

Please sign in to comment.