How to use the arangojs/lib/async/error.HttpError function in arangojs

To help you get started, we’ve selected a few arangojs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AEB-labs / cruddl / src / database / arangodb / arangojs-instrumentation / custom-connection.ts View on Github external
parsedBody = res.body.toString('utf-8');
                    } else {
                        parsedBody = res.body;
                    }
                    if (
                        parsedBody &&
                        parsedBody.hasOwnProperty('error') &&
                        parsedBody.hasOwnProperty('code') &&
                        parsedBody.hasOwnProperty('errorMessage') &&
                        parsedBody.hasOwnProperty('errorNum')
                    ) {
                        res.body = parsedBody;
                        reject(new ArangoError(res));
                    } else if (res.statusCode && res.statusCode >= 400) {
                        res.body = parsedBody;
                        reject(new HttpError(res));
                    } else {
                        if (!expectBinary) {
                            res.body = parsedBody;
                        }
                        resolve(getter ? getter(res) : (res as any));
                    }
                }
            };