Minimal error handling refactor

This commit is contained in:
Jakob Borg 2015-12-13 10:38:21 +01:00
parent c3625e16d7
commit 2b80057ac9

View File

@ -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 unmarshalErr := xml.Unmarshal(response, envelope); unmarshalErr != nil {
if err2 != nil { return unmarshalErr
return err2
} }
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)