Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use onerror instead

  • Loading branch information...
commit 84a86006a2d0e8f390458dff4f459a3d85d9862d 1 parent 668c7db
@Raynos Raynos authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 index.js
View
11 index.js
@@ -13,6 +13,10 @@ module.exports = function (opts) {
var parser = sax.parser(false);
var stream = select(parser, opts);
+
+ parser.onerror = function (err) {
+ stream.emit("error", err)
+ }
function write (buf) {
stream.emit('data', buf);
@@ -42,12 +46,7 @@ module.exports = function (opts) {
stream.write = function (buf) {
var s = buf.toString();
buffered += s;
- try {
- parser.write(buf.toString());
- } catch (err) {
- stream.emit("error", err);
- }
-
+ parser.write(buf.toString());
};
stream.end = function (buf) {
Please sign in to comment.
Something went wrong with that request. Please try again.