private static Exception OnBadTag(byte got, params byte[] want)
{
string exmsg = null;
if (want.Length == 1)
{
exmsg = string.Format(
"wrong tag encountered, expected {0}, got {1}",
want,
got);
}
else
{
exmsg = string.Format(
"wrong tag encountered, expected one of {0}, got {1}",
string.Join(", ", want),
got);
}
return new Exception(exmsg);
}
}