{"action":"created","comment":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/31735457","id":31735457,"diff_hunk":"@@ -19,48 +19,94 @@\n  */\n package org.neo4j.ndp.runtime.internal;\n \n-import org.neo4j.cypher.CypherException;\n-import org.neo4j.kernel.api.exceptions.KernelException;\n+import java.nio.charset.StandardCharsets;\n+import java.text.SimpleDateFormat;\n+import java.util.Date;\n+import java.util.TimeZone;\n+import java.util.UUID;\n+\n+import org.neo4j.helpers.Exceptions;\n+import org.neo4j.kernel.Version;\n import org.neo4j.kernel.api.exceptions.Status;\n+import org.neo4j.kernel.impl.logging.LogService;\n import org.neo4j.logging.Log;\n \n+import static javax.xml.bind.DatatypeConverter.printBase64Binary;\n+\n /**\n  * Convert the mixed exceptions the underlying engine can throw to a cohesive set of known failures. This is an\n  * intermediary mechanism.\n  */\n public class ErrorTranslator\n {\n+    private final Log internalLog;\n+    private final Log userLog;\n \n-    private final Log log;\n+    public ErrorTranslator( LogService logging )\n+    {\n+        this(logging.getUserLog( ErrorTranslator.class ), logging.getInternalLog( ErrorTranslator.class ));\n+    }\n \n-    public ErrorTranslator( Log log )\n+    public ErrorTranslator( Log userLog, Log internalLog )\n     {\n-        this.log = log;\n+        this.internalLog = internalLog;\n+        this.userLog = userLog;\n     }\n \n     public Neo4jError translate( Throwable any )\n     {\n-        if ( any instanceof KernelException )\n-        {\n-            return new Neo4jError( ((KernelException) any).status(), any.getMessage() );\n-        }\n-        else if ( any instanceof CypherException )\n-        {\n-            return new Neo4jError( ((CypherException) any).status(), any.getMessage() );\n-        }\n-        else\n+        for( Throwable cause = any; cause != null; cause = cause.getCause() )\n         {\n-            if ( any.getCause() != null )\n+            if ( cause instanceof Status.HasStatus )\n             {\n-                return translate( any.getCause() );\n+                return new Neo4jError( ((Status.HasStatus) cause).status(), any.getMessage() );\n             }\n+        }\n \n-            // Log unknown errors.\n-            log.warn( \"Client triggered unknown error: \" + any.getMessage(), any );\n+        // In this case, an error has \"slipped out\", and we don't have a good way to handle it. This indicates\n+        // a buggy code path, and we need to try to convince whoever ends up here to tell us about it.\n \n-            return new Neo4jError( Status.General.UnknownFailure, \"An unexpected failure occurred: '\"\n-                                                                  + any.getMessage() + \"'.\" );\n-        }\n+        // TODO: Perhaps move this whole block to somewhere more sensible?\n+        String reference = UUID.randomUUID().toString();\n+\n+        // Log unknown errors.\n+        userLog.error( String.format(\n+                \"Client triggered unexpected error. Help us fix this error by emailing the \" +\n+                \"following report to issues@neotechnology.com: %n%s\", generateReport( any, reference ) ), any );\n+        internalLog.error( String.format( \"Client triggered unexpected error, reference %s.\", reference), any );","path":"community/ndp/runtime/src/main/java/org/neo4j/ndp/runtime/internal/ErrorTranslator.java","position":79,"original_position":79,"commit_id":"741346195254eeba4abe06d9450fd43fbed1b911","original_commit_id":"741346195254eeba4abe06d9450fd43fbed1b911","user":{"login":"cleishm","id":79651,"avatar_url":"https://avatars.githubusercontent.com/u/79651?v=3","gravatar_id":"","url":"https://api.github.com/users/cleishm","html_url":"https://github.com/cleishm","followers_url":"https://api.github.com/users/cleishm/followers","following_url":"https://api.github.com/users/cleishm/following{/other_user}","gists_url":"https://api.github.com/users/cleishm/gists{/gist_id}","starred_url":"https://api.github.com/users/cleishm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cleishm/subscriptions","organizations_url":"https://api.github.com/users/cleishm/orgs","repos_url":"https://api.github.com/users/cleishm/repos","events_url":"https://api.github.com/users/cleishm/events{/privacy}","received_events_url":"https://api.github.com/users/cleishm/received_events","type":"User","site_admin":false},"body":"If you're pulling both the userLog and internalLog from the internal kernel StoreLogService, then it's already setup to duplicate writes to the userLog into the internalLog (ref: https://github.com/neo4j/neo4j/blob/2.3/community/kernel/src/main/java/org/neo4j/kernel/impl/logging/SimpleLogService.java#L32 )","created_at":"2015-06-04T16:02:29Z","updated_at":"2015-06-04T16:02:29Z","html_url":"https://github.com/neo4j/neo4j/pull/4748#discussion_r31735457","pull_request_url":"https://api.github.com/repos/neo4j/neo4j/pulls/4748","_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/31735457"},"html":{"href":"https://github.com/neo4j/neo4j/pull/4748#discussion_r31735457"},"pull_request":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/4748"}}},"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/4748","id":36757623,"html_url":"https://github.com/neo4j/neo4j/pull/4748","diff_url":"https://github.com/neo4j/neo4j/pull/4748.diff","patch_url":"https://github.com/neo4j/neo4j/pull/4748.patch","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/4748","number":4748,"state":"closed","locked":false,"title":"Improve NDP error reporting","user":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"body":"- Introduce detailed error reporting to send to neo tech on unexpected errors.\r\n- Handle misplaced message boundary gracefully\r\n- Add better error messages for invalid message contents","created_at":"2015-06-02T18:13:28Z","updated_at":"2015-06-04T16:02:29Z","closed_at":"2015-06-04T13:59:22Z","merged_at":"2015-06-04T13:59:22Z","merge_commit_sha":"ed3c1410f8abb0b412a2ec249f2d5aaf63f4fbcf","assignee":{"login":"nigelsmall","id":275311,"avatar_url":"https://avatars.githubusercontent.com/u/275311?v=3","gravatar_id":"","url":"https://api.github.com/users/nigelsmall","html_url":"https://github.com/nigelsmall","followers_url":"https://api.github.com/users/nigelsmall/followers","following_url":"https://api.github.com/users/nigelsmall/following{/other_user}","gists_url":"https://api.github.com/users/nigelsmall/gists{/gist_id}","starred_url":"https://api.github.com/users/nigelsmall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nigelsmall/subscriptions","organizations_url":"https://api.github.com/users/nigelsmall/orgs","repos_url":"https://api.github.com/users/nigelsmall/repos","events_url":"https://api.github.com/users/nigelsmall/events{/privacy}","received_events_url":"https://api.github.com/users/nigelsmall/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/neo4j/neo4j/pulls/4748/commits","review_comments_url":"https://api.github.com/repos/neo4j/neo4j/pulls/4748/comments","review_comment_url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/4748/comments","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/741346195254eeba4abe06d9450fd43fbed1b911","head":{"label":"jakewins:2.3-ndp-errors","ref":"2.3-ndp-errors","sha":"741346195254eeba4abe06d9450fd43fbed1b911","user":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"repo":{"id":6761171,"name":"neo4j","full_name":"jakewins/neo4j","owner":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jakewins/neo4j","description":"","fork":true,"url":"https://api.github.com/repos/jakewins/neo4j","forks_url":"https://api.github.com/repos/jakewins/neo4j/forks","keys_url":"https://api.github.com/repos/jakewins/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jakewins/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jakewins/neo4j/teams","hooks_url":"https://api.github.com/repos/jakewins/neo4j/hooks","issue_events_url":"https://api.github.com/repos/jakewins/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/jakewins/neo4j/events","assignees_url":"https://api.github.com/repos/jakewins/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/jakewins/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/jakewins/neo4j/tags","blobs_url":"https://api.github.com/repos/jakewins/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jakewins/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jakewins/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/jakewins/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jakewins/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/jakewins/neo4j/languages","stargazers_url":"https://api.github.com/repos/jakewins/neo4j/stargazers","contributors_url":"https://api.github.com/repos/jakewins/neo4j/contributors","subscribers_url":"https://api.github.com/repos/jakewins/neo4j/subscribers","subscription_url":"https://api.github.com/repos/jakewins/neo4j/subscription","commits_url":"https://api.github.com/repos/jakewins/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/jakewins/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/jakewins/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/jakewins/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/jakewins/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/jakewins/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jakewins/neo4j/merges","archive_url":"https://api.github.com/repos/jakewins/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jakewins/neo4j/downloads","issues_url":"https://api.github.com/repos/jakewins/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/jakewins/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/jakewins/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/jakewins/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jakewins/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/jakewins/neo4j/releases{/id}","created_at":"2012-11-19T13:59:44Z","updated_at":"2014-06-17T11:02:23Z","pushed_at":"2015-06-04T15:47:20Z","git_url":"git://github.com/jakewins/neo4j.git","ssh_url":"git@github.com:jakewins/neo4j.git","clone_url":"https://github.com/jakewins/neo4j.git","svn_url":"https://github.com/jakewins/neo4j","homepage":null,"size":209192,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neo4j:2.3","ref":"2.3","sha":"3f620f627e725fac863bdcbc999d9617155ed589","user":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"repo":{"id":6650539,"name":"neo4j","full_name":"neo4j/neo4j","owner":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4j/neo4j","description":"Graphs for Everyone","fork":false,"url":"https://api.github.com/repos/neo4j/neo4j","forks_url":"https://api.github.com/repos/neo4j/neo4j/forks","keys_url":"https://api.github.com/repos/neo4j/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4j/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4j/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4j/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4j/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4j/neo4j/events","assignees_url":"https://api.github.com/repos/neo4j/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4j/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4j/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4j/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4j/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4j/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4j/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4j/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4j/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4j/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4j/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4j/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4j/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4j/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4j/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4j/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4j/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4j/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4j/neo4j/merges","archive_url":"https://api.github.com/repos/neo4j/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4j/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4j/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4j/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4j/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4j/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4j/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4j/neo4j/releases{/id}","created_at":"2012-11-12T08:46:15Z","updated_at":"2015-06-04T14:43:34Z","pushed_at":"2015-06-04T15:47:32Z","git_url":"git://github.com/neo4j/neo4j.git","ssh_url":"git@github.com:neo4j/neo4j.git","clone_url":"https://github.com/neo4j/neo4j.git","svn_url":"https://github.com/neo4j/neo4j","homepage":"http://neo4j.com","size":479989,"stargazers_count":1729,"watchers_count":1729,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":688,"mirror_url":null,"open_issues_count":439,"forks":688,"open_issues":439,"watchers":1729,"default_branch":"2.3"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/4748"},"html":{"href":"https://github.com/neo4j/neo4j/pull/4748"},"issue":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/4748"},"comments":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/4748/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/4748/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/4748/commits"},"statuses":{"href":"https://api.github.com/repos/neo4j/neo4j/statuses/741346195254eeba4abe06d9450fd43fbed1b911"}}}}