ArangoDB 3 error codes according to the official documentation.
npm install --save arangodb-error-codes
const arangoErrorCodes = require('arangodb-error-codes');
db.collection(collectionName).firstExample({ id })
.catch(error => (error.errorNum === arangoErrorCodes.ERROR_HTTP_NOT_FOUND ? Promise.resolve() : Promise.reject(error)));