How to catch the "No route to host" error

@mike.maxwell is there a way to catch the "No route to host" error in

def hubAction = new hubitat.device.HubAction

I already tried below code and it doesn't get that far.

} catch (e) {
       log.error "something went wrong: $e"
   }

Scott
This might work for you...
Within your ‘catch’ method:

def error1 = e
if(error1.contains(“No route to host”)){ // use exact case & spelling for expected error message

do something here
}
else{
do something else
}

Andy

I realize now why why all my attempts at groovy failed. I was missing the Andy command. :wink:

7 Likes

I went a different way since I couldn't get it working. Thanks @Cobra

I 0nly said it might work :slight_smile:
I didn’t get a chance to test it.

1 Like

No worries !! I got what I wanted to work... a little hacky but it works !