feat: slightly more expressive exception message

More datails in exception during header parsing.
This commit is contained in:
Arek 2021-06-27 16:06:11 +02:00
parent a15c0c2a87
commit 8b7d743dad
2 changed files with 3 additions and 10 deletions

View File

@ -115,7 +115,7 @@ namespace ArStomp
var colon = line.IndexOf(":");
if (colon < 1) // must exist and cannot by first character in the line
{
throw new Exception("Cannot parse header");
throw new Exception($"Cannot parse header: colon not found. Cmd: {cmd}, line: `${line}`");
}
var key = line.Substring(0, colon);
var value = line.Substring(colon + 1);

View File

@ -286,15 +286,8 @@ namespace ArStomp
var ct = Token.Token;
try
{
Frame fr = null;
try
{
fr = Helpers.GetFrame(msg.RawData, ct);
}
catch (Exception e)
{
throw e;
}
Frame fr = Helpers.GetFrame(msg.RawData, ct);
if (fr.Type == FrameType.Error) ExpectFrame(fr, FrameType.Message);
if (fr.Type == FrameType.Message)
{