(authority: string, error: string)
| 84 | } |
| 85 | |
| 86 | export const handleConnectionErrors = (authority: string, error: string): never | void => { |
| 87 | const generalMessage = 'Ensure hub address is correct and try again' |
| 88 | |
| 89 | if (error.includes('ECONNREFUSED') || error.includes('EHOSTUNREACH')) { |
| 90 | throw Error(`Unable to connect to ${authority}. ${generalMessage}`) |
| 91 | } |
| 92 | if (error.includes('ETIMEDOUT')) { |
| 93 | throw Error(`Connection to ${authority} timed out. ${generalMessage}`) |
| 94 | } |
| 95 | if (error.includes('EHOSTDOWN')) { |
| 96 | throw Error(`The host at ${authority} is down. ${generalMessage}`) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | export const networkEnvironmentInfo = (): string => inspect(networkInterfaces()) |
| 101 |
no outgoing calls
no test coverage detected