Skip to content

Cannot check if error is instance of Neo4jError #218

Closed
@GertSallaerts

Description

@GertSallaerts

I would like to check if an error is an instance of Neo4jError but using ìnstanceof` does not work.

const { Neo4jError } = require('neo4j-driver').v1;
const e = new Neo4jError('foo');
console.log(e instanceof Neo4jError); // false

This seems to be a known issue in babel. For now I've got a workaround that checks if there is a code property on the error that starts with Neo..

This babel-transform might be a solution? https://github.com/loganfsmyth/babel-plugin-transform-builtin-extend/blob/master/src/index.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions