Improved code for all I/O operations wirh recover

Uriel Fanelli 2022-07-01 15:55:36 +02:00
parent a6b296b79a
commit 878a420a31
1 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,15 @@ func (b *AbstractBridge) configureIpAndBridgeUp() {
func (b *AbstractBridge) removeIPandBridgeInt() {
// we want the program to recover in case of issues
defer func() {
if r := recover(); r != nil {
fmt.Println("An error happened in <removeIPandBridgeInt()>, but Zoreide recovered. ")
fmt.Println("Error was: ", r)
}
}()
br, err := tenus.NewLinkFrom(b.ExistingInterface)
if err != nil {
log.Println(err.Error())