@@ -139,50 +139,65 @@ and [the `db` object](https://www.arangodb.com/docs/stable/appendix-references-d
139139
140140## Error responses
141141
142- If arangojs encounters an API error, it will throw an ` ArangoError ` with
143- an ` errorNum ` property indicating the ArangoDB error code and the ` code `
144- property indicating the HTTP status code from the response body .
142+ If the server returns an ArangoDB error response, arangojs will throw an
143+ ` ArangoError ` with an ` errorNum ` property indicating the ArangoDB error code
144+ and expose the response body as the ` response ` property of the error object .
145145
146- For any other non-ArangoDB error responses (4xx/5xx status code), it will throw
147- an ` HttpError ` error with the status code indicated by the ` code ` property.
146+ For all other errors during the request/response cycle, arangojs will throw a
147+ ` NetworkError ` or a more specific subclass thereof and expose the originating
148+ request object as the ` request ` property of the error object.
148149
149- If the server response did not indicate an error but the response body could
150- not be parsed, a regular ` SyntaxError ` may be thrown instead.
150+ If the server responded with a non-2xx status code, this ` NetworkError ` will
151+ be an ` HttpError ` with a ` code ` property indicating the HTTP status code of the
152+ response and a ` response ` property containing the response object itself.
151153
152- In all of these cases the server response object will be exposed as the
153- ` response ` property on the error object.
154+ If the error is caused by an exception, the originating exception will be
155+ available as the ` cause ` property of the error object thrown by arangojs. For
156+ network errors, this will often be a ` TypeError ` .
154157
155- If the request failed at a network level or the connection was closed without
156- receiving a response, the underlying system error will be thrown instead.
158+ ### Node.js network errors
159+
160+ In Node.js, network errors caused by a ` TypeError ` will often have a ` cause `
161+ property containing a more detailed exception.
162+
163+ Specifically, these are often either system errors (represented by regular
164+ ` Error ` objects with additional properties) or errors from the ` undici ` module
165+ Node.js uses internally for its native ` fetch ` implementation.
166+
167+ Node.js system error objects provide a ` code ` property containing the specific
168+ string error code, a ` syscall ` property identifying the underlying system call
169+ that triggered the error (e.g. ` connect ` ), as well as other helpful properties.
170+
171+ For more details on Node.js system errors, see the Node.js documentation of the
172+ [ ` SystemError ` interface] ( https://nodejs.org/api/errors.html#class-systemerror )
173+ as well as the section on
174+ [ Node.js error codes] ( https://nodejs.org/api/errors.html#nodejs-error-codes ) .
175+
176+ For more details on the errors thrown by ` undici ` , see the
177+ [ undici errors documentation] ( https://undici.nodejs.org/#/docs/api/Errors.md ) .
157178
158179## Common issues
159180
160- ### Missing functions or unexpected server errors
181+ ### Unexpected server errors
161182
162183Please make sure you are using the latest version of this driver and that the
163184version of the arangojs documentation you are reading matches that version.
164185
165- Changes in the major version number of arangojs (e.g. 7 .x.y -> 8 .0.0) indicate
186+ Changes in the major version number of arangojs (e.g. 8 .x.y -> 9 .0.0) indicate
166187backwards-incompatible changes in the arangojs API that may require changes in
167188your code when upgrading your version of arangojs.
168189
169190Additionally please ensure that your version of Node.js (or browser) and
170191ArangoDB are supported by the version of arangojs you are trying to use. See
171192the [ compatibility section] ( #compatibility ) for additional information.
172193
173- ** Note** : As of June 2018 ArangoDB 2.8 has reached its End of Life and is no
174- longer supported in arangojs 7 and later. If your code needs to work with
175- ArangoDB 2.8 you can continue using arangojs 6 and enable ArangoDB 2.8
176- compatibility mode by setting the config option ` arangoVersion: 20800 ` to
177- enable the ArangoDB 2.8 compatibility mode in arangojs 6.
178-
179194You can install an older version of arangojs using ` npm ` or ` yarn ` :
180195
181196``` sh
182- # for version 6 .x.x
183- yarn add arangojs@6
197+ # for version 8 .x.x
198+ yarn add arangojs@8
184199# - or -
185- npm install --save arangojs@6
200+ npm install --save arangojs@8
186201```
187202
188203### No code intelligence when using require instead of import
@@ -254,23 +269,6 @@ that do not support the `stack` property on error objects, this option will
254269still impact performance but not result in any additional information becoming
255270available.
256271
257- ### Node.js ` ReferenceError: window is not defined `
258-
259- If you compile your Node project using a build tool like Webpack, you may need
260- to tell it to
261- [ target the correct environment] ( https://webpack.js.org/configuration/target/ ) :
262-
263- ``` diff
264- // webpack.config.js
265- + "target": "node",
266- ```
267-
268- To support use in both browser and Node environments arangojs uses the
269- [ ` package.json ` ` browser ` field] ( https://github.com/defunctzombie/package-browser-field-spec ) ,
270- to substitute browser-specific implementations for certain modules.
271- Build tools like Webpack will respect this field when targetting a browser
272- environment and may need to be explicitly told you are targetting Node instead.
273-
274272### Node.js with self-signed HTTPS certificates
275273
276274If you need to support self-signed HTTPS certificates in Node.js, you may have
@@ -308,6 +306,9 @@ setGlobalDispatcher(
308306);
309307```
310308
309+ This is a [ known limitation] ( https://github.com/orgs/nodejs/discussions/44038#discussioncomment-5701073 )
310+ of Node.js at the time of this writing.
311+
311312When using arangojs in the browser, self-signed HTTPS certificates need to
312313be trusted by the browser or use a trusted root certificate.
313314
@@ -331,7 +332,8 @@ await trx.step(() => collection.save(doc1));
331332await trx .step (() => collection .save (doc2));
332333```
333334
334- Please refer to the documentation of this method for additional examples.
335+ Please refer to the [ documentation of the ` transaction.step ` method] ( https://arangodb.github.io/arangojs/latest/classes/transaction.Transaction.html#step )
336+ for additional examples.
335337
336338### Streaming transactions timeout in cluster
337339
0 commit comments