Skip to content

fix neo4jerror name issue #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2017
Merged

fix neo4jerror name issue #254

merged 1 commit into from
Jun 27, 2017

Conversation

praveenag
Copy link
Contributor

@praveenag praveenag commented Jun 22, 2017

instanceof Neo4jError will return false but you can use the property name instead to determine the error.
Fixes 218

@praveenag praveenag requested a review from lutovich June 22, 2017 15:45
Copy link
Contributor

@lutovich lutovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praveenag changes look good, one small question.

src/v1/error.js Outdated
@@ -44,6 +44,12 @@ class Neo4jError extends Error {
super( message );
this.message = message;
this.code = code;
Object.defineProperty(this, 'name', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just this.name = 'Neo4jError'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some reading on property definition vs assignment and by defining the property we are making it non enumerable.
http://2ality.com/2012/08/property-definition-assignment.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, code sets enumerable: false. All other properties are enumerable. Can we have name similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I will make the change and push it through.

@praveenag praveenag merged commit 4d628f5 into neo4j:1.4 Jun 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants