{"action":"closed","issue":{"url":"https://api.github.com/repos/simplyGits/MagisterJS/issues/46","repository_url":"https://api.github.com/repos/simplyGits/MagisterJS","labels_url":"https://api.github.com/repos/simplyGits/MagisterJS/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/simplyGits/MagisterJS/issues/46/comments","events_url":"https://api.github.com/repos/simplyGits/MagisterJS/issues/46/events","html_url":"https://github.com/simplyGits/MagisterJS/issues/46","id":162378220,"number":46,"title":"Occasional crash without correct error handling while using Magister.ready(callback)","user":{"login":"gruijter","id":19174120,"avatar_url":"https://avatars.githubusercontent.com/u/19174120?v=3","gravatar_id":"","url":"https://api.github.com/users/gruijter","html_url":"https://github.com/gruijter","followers_url":"https://api.github.com/users/gruijter/followers","following_url":"https://api.github.com/users/gruijter/following{/other_user}","gists_url":"https://api.github.com/users/gruijter/gists{/gist_id}","starred_url":"https://api.github.com/users/gruijter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gruijter/subscriptions","organizations_url":"https://api.github.com/users/gruijter/orgs","repos_url":"https://api.github.com/users/gruijter/repos","events_url":"https://api.github.com/users/gruijter/events{/privacy}","received_events_url":"https://api.github.com/users/gruijter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"lieuwex","id":6019113,"avatar_url":"https://avatars.githubusercontent.com/u/6019113?v=3","gravatar_id":"","url":"https://api.github.com/users/lieuwex","html_url":"https://github.com/lieuwex","followers_url":"https://api.github.com/users/lieuwex/followers","following_url":"https://api.github.com/users/lieuwex/following{/other_user}","gists_url":"https://api.github.com/users/lieuwex/gists{/gist_id}","starred_url":"https://api.github.com/users/lieuwex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lieuwex/subscriptions","organizations_url":"https://api.github.com/users/lieuwex/orgs","repos_url":"https://api.github.com/users/lieuwex/repos","events_url":"https://api.github.com/users/lieuwex/events{/privacy}","received_events_url":"https://api.github.com/users/lieuwex/received_events","type":"User","site_admin":false},"assignees":[{"login":"lieuwex","id":6019113,"avatar_url":"https://avatars.githubusercontent.com/u/6019113?v=3","gravatar_id":"","url":"https://api.github.com/users/lieuwex","html_url":"https://github.com/lieuwex","followers_url":"https://api.github.com/users/lieuwex/followers","following_url":"https://api.github.com/users/lieuwex/following{/other_user}","gists_url":"https://api.github.com/users/lieuwex/gists{/gist_id}","starred_url":"https://api.github.com/users/lieuwex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lieuwex/subscriptions","organizations_url":"https://api.github.com/users/lieuwex/orgs","repos_url":"https://api.github.com/users/lieuwex/repos","events_url":"https://api.github.com/users/lieuwex/events{/privacy}","received_events_url":"https://api.github.com/users/lieuwex/received_events","type":"User","site_admin":false}],"milestone":null,"comments":16,"created_at":"2016-06-27T05:46:43Z","updated_at":"2016-07-07T14:42:44Z","closed_at":"2016-07-07T14:42:44Z","body":"The function `Magister.ready(callback)` crashes for unknown reasons. This happens occasionally. Below function is called every 10 minutes, with the exact same credentials, and crashes after an irregular number of calls (usually within 10 calls). see response at the bottom.\r\n\r\n```javascript\r\nfunction getCourse(credentials, callback) {\r\n\tnew Magister.Magister(credentials).ready(function() {\r\n\t\tthis.currentCourse(function(error, result) {\r\n\t\t\tif (error) {\r\n\t\t\t\tconsole.log(\"got error: \" + error);\r\n\t\t\t\tcallback(error, null);\r\n\t\t\t} else {\r\n\t\t\t\tvar courseInfo = {\r\n\t\t\t\t\tperiod: result.schoolPeriod(), // e.g. 1516\r\n\t\t\t\t\tbegin: result.begin(),         // e.g. Sat Aug 01 2015 00:00:00 GMT+0200 (West-Europa (zomertijd))\r\n\t\t\t\t\tend: result.end(),             // e.g. Sun Jul 31 2016 00:00:00 GMT+0200 (West-Europa (zomertijd))\r\n\t\t\t\t\ttype: result.type(),           // e.g. { id: 1346, description: '1 gymnasium' },\r\n\t\t\t\t\tgroup: result.group(),         // e.g. { id: 6150, description: '1gb', locationId: 0 },\r\n\t\t\t\t\tclassesById: {}\r\n\t\t\t\t};\r\n\t\t\t\tresult.classes(function(error, courseClasses) {\r\n\t\t\t\t\tfor (var courseClass of courseClasses) {\r\n\t\t\t\t\t\tcourseInfo.classesById[courseClass.id()] = {\r\n\t\t\t\t\t\t\tid: courseClass.id(),                     // e.g. 532518\r\n\t\t\t\t\t\t\tabbreviation: courseClass.abbreviation(), // e.g. 'ne'\r\n\t\t\t\t\t\t\tdescription: courseClass.description(),   // e.g. 'Nederlandse taal'\r\n\t\t\t\t\t\t\tnumber: courseClass.number()              // e.g. 1\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t};\r\n\t\t\t\t\tcallback(null, courseInfo);\r\n\t\t\t\t});\r\n\t\t\t};\r\n\t\t});\r\n\t});\r\n}\r\n```\r\n\r\n\r\n```\r\nError: Not done with logging in or errored during logging in! (did you use Magister.ready(callback) to be sure that logging in is done?)\r\n    at Magister.root.Magister.Magister._forceReady (/node_modules/magister.js/lib/node/magister-node.js:3327:15)\r\n    at Magister.root.Magister.Magister.currentCourse (/node_modules/magister.js/lib/node/magister-node.js:2745:12)\r\n    at Magister.<anonymous> (/drivers/student/driver.js:352:9)\r\n    at wrapper (/node_modules/magister.js/node_modules/lodash/index.js:3095:19)\r\n    at Magister.root.Magister.Magister._setErrored (/node_modules/magister.js/lib/node/magister-node.js:3363:9)\r\n    at /node_modules/magister.js/lib/node/magister-node.js:3452:30\r\n    at Request._callback (/node_modules/magister.js/lib/node/magister-node.js:5379:16)\r\n    at Request.self.callback (/node_modules/magister.js/node_modules/request/request.js:198:22)\r\n    at emitTwo (events.js:87:13)\r\n    at Request.emit (events.js:172:7)\r\n```"}}
{"actor":{"display_login":"lieuwex"}}