@@ -16,6 +16,59 @@ This driver uses semantic versioning:
1616
1717## [ 9.2.0] - 2024-11-27
1818
19+ ### Changed
20+
21+ - Errors encountered before a request completes are now wrapped in a
22+ ` NetworkError ` or a subclass thereof
23+
24+ This should help making it easier to diagnose network issues and distinguish
25+ the relevant error conditions.
26+
27+ The originating error can still be accessed using the ` cause ` property of the
28+ ` NetworkError ` error.
29+
30+ - ` HttpError ` now extends the ` NetworkError ` class
31+
32+ This allows treating all non-` ArangoError ` errors as one category of errors,
33+ even when there is no server response available.
34+
35+ - ` db.waitForPropagation ` now throws a ` PropagationTimeoutError ` error when
36+ invoked with a ` timeout ` option and the timeout duration is exceeded
37+
38+ The method would previously throw the most recent error encountered while
39+ waiting for replication. The originating error can still be accessed using
40+ the ` cause ` property of the ` PropagationTimeoutError ` error.
41+
42+ - ` db.waitForPropagation ` now respects the ` timeout ` option more strictly
43+
44+ Previously the method would only time out if the timeout duration was
45+ exceeded after the most recent request failed. Now the timeout is
46+ recalculated and passed on to each request, preventing it from exceeding
47+ the specified duration.
48+
49+ If the propagation timed out due to an underlying request exceeding the
50+ timeout duration, the ` cause ` property of the ` PropagationTimeoutError `
51+ error will be a ` ResponseTimeoutError ` error.
52+
53+ - ` config.beforeRequest ` and ` config.afterResponse ` callbacks can now return
54+ promises
55+
56+ If the callback returns a promise, it will be awaited before the request
57+ and response cycle proceeds. If either callback throws an error or returns
58+ a promise that is rejected, that error will be thrown instead.
59+
60+ - ` config.afterResponse ` callback signature changed
61+
62+ The callback signature previously used the internal ` ArangojsResponse ` type.
63+ The new signature uses the ` Response ` type of the Fetch API with an
64+ additional ` request ` property to more accurately represent the actual value
65+ it receives as the ` parsedBody ` property will never be present.
66+
67+ - ` response ` property on ` ArangoError ` is now optional
68+
69+ This property should always be present but this allows using the error in
70+ situations where a response might not be available.
71+
1972### Added
2073
2174- Added ` database.availability ` method
@@ -26,6 +79,67 @@ This driver uses semantic versioning:
2679
2780- Added ` database.supportInfo ` method
2881
82+ - Added ` onError ` option to ` Config ` (DE-955)
83+
84+ This option can be used to specify a callback function that will be invoked
85+ whenever a request results in an error. Unlike ` afterResponse ` , this callback
86+ will be invoked even if the request completed but returned an error status.
87+ In this case the error will be the ` HttpError ` or ` ArangoError ` representing
88+ the error response.
89+
90+ If the ` onError ` callback throws an error or returns a promise that is
91+ rejected, that error will be thrown instead.
92+
93+ - Added ` NetworkError ` class
94+
95+ This is the common base class for all errors (including ` HttpError ` ) that
96+ occur while making a request. The originating error can be accessed using the
97+ ` cause ` property. The request object can be accessed using the ` request `
98+ property.
99+
100+ Note that ` ArangoError ` and the new ` PropagationTimeoutError ` error type
101+ do not extend ` NetworkError ` but may wrap an underlying error, which can
102+ be accessed using the ` cause ` property.
103+
104+ - Added ` ResponseTimeoutError ` class
105+
106+ This error extends ` NetworkError ` and is thrown when a request deliberately
107+ times out using the ` timeout ` option.
108+
109+ - Added ` RequestAbortedError ` class
110+
111+ This error extends ` NetworkError ` and is thrown when a request is aborted
112+ by using the ` db.close ` method.
113+
114+ - Added ` FetchFailedError ` class
115+
116+ This error extends ` NetworkError ` and is thrown when a request fails because
117+ the underlying ` fetch ` call fails (usually with a ` TypeError ` ).
118+
119+ In Node.js the root cause of this error (e.g. a network failure) can often be
120+ found in the ` cause ` property of the originating error, i.e. the ` cause `
121+ property of the ` cause ` property of this error.
122+
123+ In browsers the root cause is usually not exposed directly but can often
124+ be diagnosed by examining the developer console or network tab.
125+
126+ - Added ` PropagationTimeoutError ` class
127+
128+ This error does not extend ` NetworkError ` but wraps the most recent error
129+ encountered while waiting for replication, which can be accessed using the
130+ ` cause ` property. This error is only thrown when ` db.waitForPropagation `
131+ is invoked with a ` timeout ` option and the timeout duration is exceeded.
132+
133+ - Added ` ProcessedResponse ` type
134+
135+ This type replaces the previously internal ` ArangojsResponse ` type and
136+ extends the native ` Response ` type with additional properties.
137+
138+ - Added optional ` ArangoError#request ` property
139+
140+ This property is always present if the error has a ` response ` property. In
141+ normal use this should always be the case.
142+
29143- Added ` keepNull ` option to ` CollectionInsertOptions ` type (DE-946)
30144
31145 This option was previously missing from the type.
0 commit comments