MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / handleConnectionErrors

Function handleConnectionErrors

src/lib/live-logging.ts:86–98  ·  view source on GitHub ↗
(authority: string, error: string)

Source from the content-addressed store, hash-verified

84}
85
86export 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
100export const networkEnvironmentInfo = (): string => inspect(networkInterfaces())
101

Callers 3

requestFunction · 0.85
handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected