Skip to content

Commit 5561283

Browse files
authored
Fix network system error reporting (#1156)
2 parents 7c200cd + b52c6ec commit 5561283

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased [patch]
6+
7+
> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs.
8+
9+
### Fixed
10+
11+
- Fix network system error reporting
12+
513
## 5.4.0 - 2025-05-21
614

715
_Full changeset and discussions: [#1155](https://github.com/OpenTermsArchive/engine/pull/1155)._

src/archivist/fetcher/htmlOnlyFetcher.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export default async function fetch(url, config) {
4949
content,
5050
};
5151
} catch (error) {
52+
if (error.type == 'system') { // Node-fetch wraps system-level errors (ENOTFOUND, ECONNREFUSED, ECONNRESET, etc.) with type 'system' and includes the original error code
53+
throw new Error(`Network system error ${error.code} occurred when trying to fetch '${url}'`);
54+
}
55+
5256
if (error instanceof AbortError) {
5357
throw new Error(`Timed out after ${config.navigationTimeout / 1000} seconds when trying to fetch '${url}'`);
5458
}

0 commit comments

Comments
 (0)