{"action":"created","comment":{"url":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments/60950648","id":60950648,"diff_hunk":"@@ -63,31 +66,62 @@ class Poller\n         } catch (err) {\n             log.error(`Error when updating Weboob in polling: ${err.message}`);\n         }\n-\n+        let checkAccounts = false;\n         try {\n-\n             // Check accounts and operations!\n-            let checkAccounts = await Config.findOrCreateDefaultBooleanValue(\n+            checkAccounts = await Config.findOrCreateDefaultBooleanValue(\n                 'weboob-auto-merge-accounts'\n             );\n+        } catch (err) {\n+            log.error(`Could not retrieve 'weboob-auto-merge-accounts':\n+                ${err.toString()}`);\n+        }\n \n-            log.info('Checking new operations for all accesses...');\n-            if (checkAccounts) {\n-                log.info('\\t(will also check for accounts to merge)');\n-            }\n-\n+        // We go on even if the parameter weboob-auto-merge-accounts is\n+        // not caught. By default, the merge is not done.\n+        log.info('Checking new operations for all accesses...');\n+        if (checkAccounts) {\n+            log.info('\\t(will also check for accounts to merge)');\n+        }\n+        try {\n             let accesses = await Access.all();\n             for (let access of accesses) {\n                 let accountManager = new AccountManager;\n-                if (checkAccounts) {\n-                    await accountManager.retrieveAccountsByAccess(\n-                        access,\n-                        false\n-                    );\n+                try {\n+                    // Only import if last poll did not raise a\n+                    // login/parameter error\n+                    if (access.canAccessBePolled()) {\n+                        if (checkAccounts) {\n+                            await accountManager.retrieveAccountsByAccess(\n+                                access, false);\n+                        }\n+                        await accountManager.retrieveOperationsByAccess(\n+                            access, cb);\n+                    } else {\n+                        let error = 'Cannot poll, last import raised:';\n+                        log.info(`${error} ${access.fetchStatus}`);\n+                    }\n+                } catch (err) {\n+                    log.error(`Error when polling accounts:\n+                        ${err.message}`);\n+                    if (err.errCode) {\n+                        if (err.errCode ===\n+                            getErrorCode('NO_PASSWORD') &&\n+                            !this.sentNoPasswordNotification) {\n+                            // TODO do something with this\n+                            this.sentNoPasswordNotification = true;\n+                        }\n+                        if (isCredentialError(err)) {\n+                            await this.manageCredentialErrors(access, err);\n+                        }\n+                    }\n                 }\n-                await accountManager.retrieveOperationsByAccess(access, cb);\n             }\n+        } catch (err) {\n+            log.error(`Error when polling accounts: ${err.message}`);\n+        }\n \n+        try {","path":"server/lib/poller.js","position":91,"original_position":91,"commit_id":"58d7e5214256ecc0a0d361d739d0cb98cdca09ab","original_commit_id":"58d7e5214256ecc0a0d361d739d0cb98cdca09ab","user":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"body":"Can this try/catch merged with the one above?","created_at":"2016-04-25T17:13:01Z","updated_at":"2016-04-25T17:13:01Z","html_url":"https://github.com/bnjbvr/kresus/pull/398#discussion_r60950648","pull_request_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/398","_links":{"self":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments/60950648"},"html":{"href":"https://github.com/bnjbvr/kresus/pull/398#discussion_r60950648"},"pull_request":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/398"}}},"pull_request":{"url":"https://api.github.com/repos/bnjbvr/kresus/pulls/398","id":66064940,"html_url":"https://github.com/bnjbvr/kresus/pull/398","diff_url":"https://github.com/bnjbvr/kresus/pull/398.diff","patch_url":"https://github.com/bnjbvr/kresus/pull/398.patch","issue_url":"https://api.github.com/repos/bnjbvr/kresus/issues/398","number":398,"state":"open","locked":false,"title":"Polling","user":{"login":"ZeHiro","id":7999082,"avatar_url":"https://avatars.githubusercontent.com/u/7999082?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeHiro","html_url":"https://github.com/ZeHiro","followers_url":"https://api.github.com/users/ZeHiro/followers","following_url":"https://api.github.com/users/ZeHiro/following{/other_user}","gists_url":"https://api.github.com/users/ZeHiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeHiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeHiro/subscriptions","organizations_url":"https://api.github.com/users/ZeHiro/orgs","repos_url":"https://api.github.com/users/ZeHiro/repos","events_url":"https://api.github.com/users/ZeHiro/events{/privacy}","received_events_url":"https://api.github.com/users/ZeHiro/received_events","type":"User","site_admin":false},"body":"I don't send an email for solving #397. Could be easily fixed.","created_at":"2016-04-11T21:23:52Z","updated_at":"2016-04-25T17:13:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c63103a298540cc2e8adcd77c030766015ea89e0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/398/commits","review_comments_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/398/comments","review_comment_url":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bnjbvr/kresus/issues/398/comments","statuses_url":"https://api.github.com/repos/bnjbvr/kresus/statuses/58d7e5214256ecc0a0d361d739d0cb98cdca09ab","head":{"label":"ZeHiro:polling","ref":"polling","sha":"58d7e5214256ecc0a0d361d739d0cb98cdca09ab","user":{"login":"ZeHiro","id":7999082,"avatar_url":"https://avatars.githubusercontent.com/u/7999082?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeHiro","html_url":"https://github.com/ZeHiro","followers_url":"https://api.github.com/users/ZeHiro/followers","following_url":"https://api.github.com/users/ZeHiro/following{/other_user}","gists_url":"https://api.github.com/users/ZeHiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeHiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeHiro/subscriptions","organizations_url":"https://api.github.com/users/ZeHiro/orgs","repos_url":"https://api.github.com/users/ZeHiro/repos","events_url":"https://api.github.com/users/ZeHiro/events{/privacy}","received_events_url":"https://api.github.com/users/ZeHiro/received_events","type":"User","site_admin":false},"repo":{"id":42952362,"name":"kresus","full_name":"ZeHiro/kresus","owner":{"login":"ZeHiro","id":7999082,"avatar_url":"https://avatars.githubusercontent.com/u/7999082?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeHiro","html_url":"https://github.com/ZeHiro","followers_url":"https://api.github.com/users/ZeHiro/followers","following_url":"https://api.github.com/users/ZeHiro/following{/other_user}","gists_url":"https://api.github.com/users/ZeHiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeHiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeHiro/subscriptions","organizations_url":"https://api.github.com/users/ZeHiro/orgs","repos_url":"https://api.github.com/users/ZeHiro/repos","events_url":"https://api.github.com/users/ZeHiro/events{/privacy}","received_events_url":"https://api.github.com/users/ZeHiro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ZeHiro/kresus","description":"Get rich, or die codin'","fork":true,"url":"https://api.github.com/repos/ZeHiro/kresus","forks_url":"https://api.github.com/repos/ZeHiro/kresus/forks","keys_url":"https://api.github.com/repos/ZeHiro/kresus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZeHiro/kresus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZeHiro/kresus/teams","hooks_url":"https://api.github.com/repos/ZeHiro/kresus/hooks","issue_events_url":"https://api.github.com/repos/ZeHiro/kresus/issues/events{/number}","events_url":"https://api.github.com/repos/ZeHiro/kresus/events","assignees_url":"https://api.github.com/repos/ZeHiro/kresus/assignees{/user}","branches_url":"https://api.github.com/repos/ZeHiro/kresus/branches{/branch}","tags_url":"https://api.github.com/repos/ZeHiro/kresus/tags","blobs_url":"https://api.github.com/repos/ZeHiro/kresus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZeHiro/kresus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZeHiro/kresus/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZeHiro/kresus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZeHiro/kresus/statuses/{sha}","languages_url":"https://api.github.com/repos/ZeHiro/kresus/languages","stargazers_url":"https://api.github.com/repos/ZeHiro/kresus/stargazers","contributors_url":"https://api.github.com/repos/ZeHiro/kresus/contributors","subscribers_url":"https://api.github.com/repos/ZeHiro/kresus/subscribers","subscription_url":"https://api.github.com/repos/ZeHiro/kresus/subscription","commits_url":"https://api.github.com/repos/ZeHiro/kresus/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZeHiro/kresus/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZeHiro/kresus/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZeHiro/kresus/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZeHiro/kresus/contents/{+path}","compare_url":"https://api.github.com/repos/ZeHiro/kresus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZeHiro/kresus/merges","archive_url":"https://api.github.com/repos/ZeHiro/kresus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZeHiro/kresus/downloads","issues_url":"https://api.github.com/repos/ZeHiro/kresus/issues{/number}","pulls_url":"https://api.github.com/repos/ZeHiro/kresus/pulls{/number}","milestones_url":"https://api.github.com/repos/ZeHiro/kresus/milestones{/number}","notifications_url":"https://api.github.com/repos/ZeHiro/kresus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZeHiro/kresus/labels{/name}","releases_url":"https://api.github.com/repos/ZeHiro/kresus/releases{/id}","deployments_url":"https://api.github.com/repos/ZeHiro/kresus/deployments","created_at":"2015-09-22T18:19:53Z","updated_at":"2016-01-19T07:23:00Z","pushed_at":"2016-04-25T06:52:14Z","git_url":"git://github.com/ZeHiro/kresus.git","ssh_url":"git@github.com:ZeHiro/kresus.git","clone_url":"https://github.com/ZeHiro/kresus.git","svn_url":"https://github.com/ZeHiro/kresus","homepage":"","size":7220,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bnjbvr:incoming","ref":"incoming","sha":"c6d68ec1221fcb5892a4679802c93a858d0bf04c","user":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"repo":{"id":22532326,"name":"kresus","full_name":"bnjbvr/kresus","owner":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bnjbvr/kresus","description":"Get rich, or die codin'","fork":false,"url":"https://api.github.com/repos/bnjbvr/kresus","forks_url":"https://api.github.com/repos/bnjbvr/kresus/forks","keys_url":"https://api.github.com/repos/bnjbvr/kresus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bnjbvr/kresus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bnjbvr/kresus/teams","hooks_url":"https://api.github.com/repos/bnjbvr/kresus/hooks","issue_events_url":"https://api.github.com/repos/bnjbvr/kresus/issues/events{/number}","events_url":"https://api.github.com/repos/bnjbvr/kresus/events","assignees_url":"https://api.github.com/repos/bnjbvr/kresus/assignees{/user}","branches_url":"https://api.github.com/repos/bnjbvr/kresus/branches{/branch}","tags_url":"https://api.github.com/repos/bnjbvr/kresus/tags","blobs_url":"https://api.github.com/repos/bnjbvr/kresus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bnjbvr/kresus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bnjbvr/kresus/git/refs{/sha}","trees_url":"https://api.github.com/repos/bnjbvr/kresus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bnjbvr/kresus/statuses/{sha}","languages_url":"https://api.github.com/repos/bnjbvr/kresus/languages","stargazers_url":"https://api.github.com/repos/bnjbvr/kresus/stargazers","contributors_url":"https://api.github.com/repos/bnjbvr/kresus/contributors","subscribers_url":"https://api.github.com/repos/bnjbvr/kresus/subscribers","subscription_url":"https://api.github.com/repos/bnjbvr/kresus/subscription","commits_url":"https://api.github.com/repos/bnjbvr/kresus/commits{/sha}","git_commits_url":"https://api.github.com/repos/bnjbvr/kresus/git/commits{/sha}","comments_url":"https://api.github.com/repos/bnjbvr/kresus/comments{/number}","issue_comment_url":"https://api.github.com/repos/bnjbvr/kresus/issues/comments{/number}","contents_url":"https://api.github.com/repos/bnjbvr/kresus/contents/{+path}","compare_url":"https://api.github.com/repos/bnjbvr/kresus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bnjbvr/kresus/merges","archive_url":"https://api.github.com/repos/bnjbvr/kresus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bnjbvr/kresus/downloads","issues_url":"https://api.github.com/repos/bnjbvr/kresus/issues{/number}","pulls_url":"https://api.github.com/repos/bnjbvr/kresus/pulls{/number}","milestones_url":"https://api.github.com/repos/bnjbvr/kresus/milestones{/number}","notifications_url":"https://api.github.com/repos/bnjbvr/kresus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bnjbvr/kresus/labels{/name}","releases_url":"https://api.github.com/repos/bnjbvr/kresus/releases{/id}","deployments_url":"https://api.github.com/repos/bnjbvr/kresus/deployments","created_at":"2014-08-01T22:54:37Z","updated_at":"2016-04-25T15:47:28Z","pushed_at":"2016-04-25T06:52:14Z","git_url":"git://github.com/bnjbvr/kresus.git","ssh_url":"git@github.com:bnjbvr/kresus.git","clone_url":"https://github.com/bnjbvr/kresus.git","svn_url":"https://github.com/bnjbvr/kresus","homepage":"","size":7340,"stargazers_count":63,"watchers_count":63,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":119,"forks":27,"open_issues":119,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/398"},"html":{"href":"https://github.com/bnjbvr/kresus/pull/398"},"issue":{"href":"https://api.github.com/repos/bnjbvr/kresus/issues/398"},"comments":{"href":"https://api.github.com/repos/bnjbvr/kresus/issues/398/comments"},"review_comments":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/398/comments"},"review_comment":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bnjbvr/kresus/pulls/398/commits"},"statuses":{"href":"https://api.github.com/repos/bnjbvr/kresus/statuses/58d7e5214256ecc0a0d361d739d0cb98cdca09ab"}}}}