{"action":"created","issue":{"url":"https://api.github.com/repos/chanind/hanzi-writer/issues/42","repository_url":"https://api.github.com/repos/chanind/hanzi-writer","labels_url":"https://api.github.com/repos/chanind/hanzi-writer/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/chanind/hanzi-writer/issues/42/comments","events_url":"https://api.github.com/repos/chanind/hanzi-writer/issues/42/events","html_url":"https://github.com/chanind/hanzi-writer/pull/42","id":294301808,"number":42,"title":"fix: better error loading of char data","user":{"login":"vaab","id":703255,"avatar_url":"https://avatars3.githubusercontent.com/u/703255?v=4","gravatar_id":"","url":"https://api.github.com/users/vaab","html_url":"https://github.com/vaab","followers_url":"https://api.github.com/users/vaab/followers","following_url":"https://api.github.com/users/vaab/following{/other_user}","gists_url":"https://api.github.com/users/vaab/gists{/gist_id}","starred_url":"https://api.github.com/users/vaab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaab/subscriptions","organizations_url":"https://api.github.com/users/vaab/orgs","repos_url":"https://api.github.com/users/vaab/repos","events_url":"https://api.github.com/users/vaab/events{/privacy}","received_events_url":"https://api.github.com/users/vaab/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-02-05T07:57:05Z","updated_at":"2018-02-11T08:32:06Z","closed_at":"2018-02-06T16:53:28Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/chanind/hanzi-writer/pulls/42","html_url":"https://github.com/chanind/hanzi-writer/pull/42","diff_url":"https://github.com/chanind/hanzi-writer/pull/42.diff","patch_url":"https://github.com/chanind/hanzi-writer/pull/42.patch"},"body":"The user-defined function is now given a reject callback to trigger error\r\nconditions while loading new character data. Please note that the\r\nrunning code (not the user-defined function) is also given a chance to\r\nreject the promise (and thus trigger the calling of the error callback)\r\nwhen it receives a second loading request before the current one is\r\nfinished.\r\n\r\nThis should fix the issues with the error being reported only on next call \r\nif user-defined function doesn't handle errors itself correctly.\r\n\r\nPlease note that it doesn't provide a radical change of the API of the user defined function as I suggested in an open issue #41 ... and thus should remain mostly compatible with any custom made user function."},"comment":{"url":"https://api.github.com/repos/chanind/hanzi-writer/issues/comments/364733443","html_url":"https://github.com/chanind/hanzi-writer/pull/42#issuecomment-364733443","issue_url":"https://api.github.com/repos/chanind/hanzi-writer/issues/42","id":364733443,"user":{"login":"vaab","id":703255,"avatar_url":"https://avatars3.githubusercontent.com/u/703255?v=4","gravatar_id":"","url":"https://api.github.com/users/vaab","html_url":"https://github.com/vaab","followers_url":"https://api.github.com/users/vaab/followers","following_url":"https://api.github.com/users/vaab/following{/other_user}","gists_url":"https://api.github.com/users/vaab/gists{/gist_id}","starred_url":"https://api.github.com/users/vaab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaab/subscriptions","organizations_url":"https://api.github.com/users/vaab/orgs","repos_url":"https://api.github.com/users/vaab/repos","events_url":"https://api.github.com/users/vaab/events{/privacy}","received_events_url":"https://api.github.com/users/vaab/received_events","type":"User","site_admin":false},"created_at":"2018-02-11T08:32:06Z","updated_at":"2018-02-11T08:32:06Z","author_association":"CONTRIBUTOR","body":"> However, we can just try reloading automatically and save the user the trouble of having to call \r\n> writer.setCharacter(...) first again.\r\n\r\nHmm, but if it failed loading once, loading twice won't help it, will it ? Simply retrying won't fix the issue only in very special and rare cases. The most common failure is if the character is not in the database for instance. Other common failure would be connection error to the server after 60s timeout. Why bother retrying ?  In your scenario ``animateForever()`` should simply fail if no character was set, or at least do nothing. I'm not expecting ``animateForever()`` to retry something that already failed previously. Sorry if I misunderstood a point you wanted to make.\r\n\r\nCurrently, ``setCharacter()`` returns a promise, but not the one expected actually : if the character was not setup, we have no way to know that in the code. A reject of the promise from ``setCharacter()`` could be quite expected. What do you think ? As a user I could write:\r\n\r\n```\r\n     hw.setCharacter($el.value()).then(() => hw.animateForever(), () => console.log('Harrr crap !'));\r\n```\r\n\r\nFor the debounce part, all this makes sense, and was already implemented in my proposal, or I may have missed some corner cases, but it was the intention.\r\n\r\nYes, an exception seems to me the right way to go if no ``onLoadCharErr`` is provided. I saw that you did implement that and wrote test about. Thx a lot.\r\n"}}
{"actor":{"display_login":"vaab"}}