internet: More helpful error messages; enable in all builds

This commit is contained in:
Tom Henderson
2016-09-16 21:26:11 -07:00
parent 08d6ee696b
commit de69e95705
2 changed files with 13 additions and 9 deletions

View File

@@ -328,7 +328,10 @@ Ipv4Interface::GetAddress (uint32_t index) const
++tmp;
}
}
NS_ASSERT (false); // Assert if not found
else
{
NS_FATAL_ERROR ("index " << index << " out of bounds");
}
Ipv4InterfaceAddress addr;
return (addr); // quiet compiler
}
@@ -339,7 +342,7 @@ Ipv4Interface::RemoveAddress (uint32_t index)
NS_LOG_FUNCTION (this << index);
if (index >= m_ifaddrs.size ())
{
NS_ASSERT_MSG (false, "Bug in Ipv4Interface::RemoveAddress");
NS_FATAL_ERROR ("Bug in Ipv4Interface::RemoveAddress");
}
Ipv4InterfaceAddressListI i = m_ifaddrs.begin ();
uint32_t tmp = 0;
@@ -354,7 +357,7 @@ Ipv4Interface::RemoveAddress (uint32_t index)
++tmp;
++i;
}
NS_ASSERT_MSG (false, "Address " << index << " not found");
NS_FATAL_ERROR ("Address " << index << " not found");
Ipv4InterfaceAddress addr;
return (addr); // quiet compiler
}

View File

@@ -114,7 +114,7 @@ void Ipv6Interface::DoSetup ()
}
else
{
NS_ASSERT_MSG (false, "IPv6 autoconf for this kind of address not implemented.");
NS_FATAL_ERROR ("IPv6 autoconf for this kind of address not implemented.");
}
}
else
@@ -299,8 +299,10 @@ Ipv6InterfaceAddress Ipv6Interface::GetAddress (uint32_t index) const
i++;
}
}
NS_ASSERT_MSG (false, "Address " << index << " not found");
else
{
NS_FATAL_ERROR ("index " << index << " out of bounds");
}
Ipv6InterfaceAddress addr;
return addr; /* quiet compiler */
}
@@ -318,7 +320,7 @@ Ipv6InterfaceAddress Ipv6Interface::RemoveAddress (uint32_t index)
if (m_addresses.size () < index)
{
NS_ASSERT_MSG (false, "Try to remove index that don't exist in Ipv6Interface::RemoveAddress");
NS_FATAL_ERROR ("Removing index that does not exist in Ipv6Interface::RemoveAddress");
}
for (Ipv6InterfaceAddressListI it = m_addresses.begin (); it != m_addresses.end (); ++it)
@@ -332,8 +334,7 @@ Ipv6InterfaceAddress Ipv6Interface::RemoveAddress (uint32_t index)
i++;
}
NS_ASSERT_MSG (false, "Address " << index << " not found");
NS_FATAL_ERROR ("Address " << index << " not found");
Ipv6InterfaceAddress addr;
return addr; /* quiet compiler */
}