Skip to content

Commit

Permalink
Merge pull request #136 from blocknative/release/3.4.1
Browse files Browse the repository at this point in the history
Release 3.4.1
  • Loading branch information
lnbc1QWFyb24 authored Jul 8, 2021
2 parents acc498c + a7d5f0b commit a5c9f53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bnc-sdk",
"version": "3.4.0",
"version": "3.4.1",
"description": "SDK to connect to the blocknative backend via a websocket connection",
"keywords": [
"ethereum",
Expand Down
17 changes: 13 additions & 4 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@ function configuration(
return new Promise((resolve, reject) => {
subscription.pipe(take(1), timeout(5000)).subscribe({
next: () => resolve({ ...emitter, details: { config } }),
error: () =>
reject(
`Configuration with scope: ${config.scope} has been sent to the Blocknative server, but has not received a reply within 5 seconds.`
)
error: (error: { message: string }) => {
const message =
error.message === 'Timeout has occurred'
? `Configuration with scope: ${config.scope} has been sent to the Blocknative server, but has not received a reply within 5 seconds.`
: error.message

if (this._onerror) {
this._onerror({ message })
resolve(`Error: ${message}`)
} else {
reject(message)
}
}
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function handleMessage(this: any, msg: { data: string }): void {
const configuration = this._configurations.get(event.config.scope)

if (configuration && configuration.subscription) {
configuration.subscription.error(reason)
configuration.subscription.error({ message: reason })
}

return
Expand Down

0 comments on commit a5c9f53

Please sign in to comment.