Skip to content

Commit

Permalink
Update dependencies, catch http parse error (floating#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
floating committed Nov 4, 2018
1 parent ed7d0f7 commit 02cf5e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions connections/http.js
Expand Up @@ -42,7 +42,13 @@ class HTTPConnection extends EventEmitter {
return this.emit('error', err)
} else {
if (!this.closed) this.subscriptionTimeout = this.pollSubscriptions()
if (result) result.map(p => JSON.parse(p)).forEach(p => this.emit('payload', p))
if (result) {
result.map(p => {
let parse
try { parse = JSON.parse(p) } catch (e) { parse = false }
return parse
}).filter(n => n).forEach(p => this.emit('payload', p))
}
}
})
}
Expand Down Expand Up @@ -88,7 +94,7 @@ class HTTPConnection extends EventEmitter {
}
try { this.post.body = JSON.stringify(payload) } catch (e) { return res(e) }
xhr.open('POST', this.url, true)
xhr.timeout = 20000
xhr.timeout = 60 * 1000
xhr.onerror = res
xhr.ontimeout = res
xhr.onreadystatechange = () => {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "eth-provider",
"version": "0.1.2",
"version": "0.1.3",
"description": "A Universal Ethereum Provider",
"browser": "browser.js",
"main": "node.js",
Expand All @@ -19,7 +19,7 @@
"license": "GPL-3.0",
"repository": "github:floating/eth-provider",
"dependencies": {
"ethereum-provider": "0.0.4",
"ethereum-provider": "0.0.5",
"oboe": "2.1.4",
"uuid": "3.3.2",
"ws": "6.1.0",
Expand Down

0 comments on commit 02cf5e8

Please sign in to comment.