Skip to content

Commit a8be2f1

Browse files
committed
netcore: sync exception messages with netfx
Messages of the netfx exceptions are more detailed
1 parent 43e90dd commit a8be2f1

File tree

1 file changed

+4
-4
lines changed
  • src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient

1 file changed

+4
-4
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ private PreLoginHandshakeStatus ConsumePreLoginHandshake(
964964

965965
if (_physicalStateObj._inBytesPacket > TdsEnums.MAX_PACKET_SIZE || _physicalStateObj._inBytesPacket <= 0)
966966
{
967-
throw SQL.ParsingError();
967+
throw SQL.ParsingError(ParsingErrorState.CorruptedTdsStream);
968968
}
969969
byte[] payload = new byte[_physicalStateObj._inBytesPacket];
970970

@@ -2105,7 +2105,7 @@ internal TdsOperationStatus TryRun(RunBehavior runBehavior, SqlCommand cmdHandle
21052105
#if DEBUG
21062106
throw new InvalidOperationException(message);
21072107
#else
2108-
throw SQL.ParsingError();
2108+
throw SQL.ParsingErrorToken(ParsingErrorState.InvalidTdsTokenReceived, token); // MDAC 82443
21092109
#endif
21102110

21112111
}
@@ -3674,7 +3674,7 @@ private TdsOperationStatus TryProcessSessionState(TdsParserStateObject stateObj,
36743674
{
36753675
if (length < 5)
36763676
{
3677-
throw SQL.ParsingError();
3677+
throw SQL.ParsingErrorLength(ParsingErrorState.SessionStateLengthTooShort, length);
36783678
}
36793679
uint seqNum;
36803680
TdsOperationStatus result = stateObj.TryReadUInt32(out seqNum);
@@ -3694,7 +3694,7 @@ private TdsOperationStatus TryProcessSessionState(TdsParserStateObject stateObj,
36943694
}
36953695
if (status > 1)
36963696
{
3697-
throw SQL.ParsingError();
3697+
throw SQL.ParsingErrorStatus(ParsingErrorState.SessionStateInvalidStatus, status);
36983698
}
36993699
bool recoverable = status != 0;
37003700
length -= 5;

0 commit comments

Comments
 (0)