diff options
author | anekos | 2010-08-04 10:42:15 +0000 |
---|---|---|
committer | anekos | 2010-08-04 10:42:15 +0000 |
commit | 2cb3800105d65db42054a5734efa769351453f24 (patch) | |
tree | f41659e7d9597bd384e5d265f1226618736124b3 /twittperator.js | |
parent | a26b7c88d6c626ccba8997e681bfae44b2d8332e (diff) | |
download | vimperator-plugins-2cb3800105d65db42054a5734efa769351453f24.tar.bz2 |
エラー時に停止するように。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38165 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'twittperator.js')
-rwxr-xr-x | twittperator.js | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/twittperator.js b/twittperator.js index c63a69d..3f333ee 100755 --- a/twittperator.js +++ b/twittperator.js @@ -1136,21 +1136,25 @@ let buf = ""; let interval = setInterval(function () { - let len = sis.available(); - if (len <= 0) - return; - let data = sis.read(len); - let lines = data.split(/\n/); - if (lines.length > 2) { - lines[0] = buf + lines[0]; - for (let [, line] in Iterator(lines.slice(0, -1))) { - try { - onMsg(JSON.parse(line), line); - } catch (e) {} + try { + let len = sis.available(); + if (len <= 0) + return; + let data = sis.read(len); + let lines = data.split(/\n/); + if (lines.length > 2) { + lines[0] = buf + lines[0]; + for (let [, line] in Iterator(lines.slice(0, -1))) { + try { + onMsg(JSON.parse(line), line); + } catch (e) {} + } + buf = lines.slice(-1)[0]; + } else { + buf += data; } - buf = lines.slice(-1)[0]; - } else { - buf += data; + } catch (e) { + stop(); } }, 500); |