Browse Source

Minimal error handling refactor

Jakob Borg 10 years ago
parent
commit
2b80057ac9
1 changed files with 2 additions and 3 deletions
  1. 2 3
      lib/upnp/upnp.go

+ 2 - 3
lib/upnp/upnp.go

@@ -531,9 +531,8 @@ func (s *IGDService) AddPortMapping(localIPAddress string, protocol Protocol, ex
 	if err != nil && timeout > 0 {
 	if err != nil && timeout > 0 {
 		// Try to repair error code 725 - OnlyPermanentLeasesSupported
 		// Try to repair error code 725 - OnlyPermanentLeasesSupported
 		envelope := &soapErrorResponse{}
 		envelope := &soapErrorResponse{}
-		err2 := xml.Unmarshal(response, envelope)
-		if err2 != nil {
-			return err2
+		if unmarshalErr := xml.Unmarshal(response, envelope); unmarshalErr != nil {
+			return unmarshalErr
 		}
 		}
 		if envelope.ErrorCode == 725 {
 		if envelope.ErrorCode == 725 {
 			return s.AddPortMapping(localIPAddress, protocol, externalPort, internalPort, description, 0)
 			return s.AddPortMapping(localIPAddress, protocol, externalPort, internalPort, description, 0)