Skip to content

Commit

Permalink
better edge case handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Jan 23, 2024
1 parent 7949338 commit 76d761a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nostrwatch/nocap-every-adapter-default",
"version": "1.0.4",
"version": "1.0.5",
"type": "module",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,6 +9,6 @@
"@nostrwatch/nocap-geo-adapter-default": "^1.0.0",
"@nostrwatch/nocap-info-adapter-default": "^1.0.0",
"@nostrwatch/nocap-ssl-adapter-default": "^1.0.1",
"@nostrwatch/nocap-websocket-adapter-default": "^1.0.2"
"@nostrwatch/nocap-websocket-adapter-default": "^1.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ class WebsocketAdapterDefault {
* @returns null
*/
handle_nostr_event(buffer){
let ev
try{
const ev = JSON.parse(buffer.toString())
ev = JSON.parse(buffer.toString())
}
catch(e){
this.$.logger.err(`${this.$.url} responded with invalid JSON: ${e}`)
return this.$.on_error(e)
return
}
if(!ev || !(ev instanceof Array) || !ev.length) return
if(ev[0] === 'EVENT') {
if(this.$.subid('read') === ev[1])
this.$.on_event(ev[1], ev[2])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nostrwatch/nocap-websocket-adapter-default",
"version": "1.0.2",
"version": "1.0.3",
"type": "module",
"main": "index.js",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/nocap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nostrwatch/nocap",
"version": "0.1.6",
"version": "0.1.7",
"main": "src/index.js",
"type": "module",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"dependencies": {
"@nostrwatch/logger": "^0.0.1",
"@nostrwatch/nocap-every-adapter-default": "^1.0.4",
"@nostrwatch/nocap-every-adapter-default": "^1.0.5",
"@nostrwatch/utils": "^0.0.1",
"fetch-h2": "3.0.2",
"get-ssl-certificate": "2.3.3",
Expand Down

0 comments on commit 76d761a

Please sign in to comment.