let -> const and reject with error

This commit is contained in:
Elliot Lee
2019-10-23 12:25:02 -07:00
parent 034f8d41fc
commit cfdc4752d0

View File

@@ -287,9 +287,9 @@ class Connection extends EventEmitter {
connect(): Promise<void> {
this._clearReconnectTimer()
return new Promise<void>((resolve, reject) => {
let connectTimeout = setTimeout(() => {
reject(`Error: connect() timed out after ${this._connectionTimeout} ms. ` +
`If your internet connection is working, the rippled server may be blocked or inaccessible.`)
const connectTimeout = setTimeout(() => {
reject(new ConnectionError(`Error: connect() timed out after ${this._connectionTimeout} ms. ` +
`If your internet connection is working, the rippled server may be blocked or inaccessible.`))
}, this._connectionTimeout)
if (!this._url) {
reject(new ConnectionError(