DB Drivers
NodeJS Driver
Discover the Peaka NodeJS driver
Requirements
- Node 12 or newer.
Install
npm install @peaka/client
or
yarn add @peaka/client
Usage
Create a Peaka connection
Submit a query
Iterate through the query results
Alternative: map and aggregate the data
Handle the Errors
Query errors are returned in two different ways.
- The
connection.query()
method throws an error object, and theerror.response.data
object contains the following properties:
Error Property | Description |
---|---|
errorCode | Code of error |
message | Description of the error |
traceId | The identifier that you can give Peaka Team to learn more about the error |
- The
connection.query()
method returns successfully, but the response may include anerror
object with the following structure:
In order to handle all possible errors, please make sure to check both objects, as demonstrated in the example below: