Skip to content

Commit 70fcf32

Browse files
committed
Rename NpgsqlException and NpgsqlNotice
To PostgresException and PostgresNotice respectively.
1 parent e3c7fdc commit 70fcf32

20 files changed

Lines changed: 61 additions & 61 deletions

src/Npgsql/GeneratedAsync.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ async Task<IBackendMessage> ReadMessageWithPrependedAsync(CancellationToken canc
641641
ReceiveTimeout = UserTimeout;
642642
return await DoReadMessageAsync(cancellationToken, dataRowLoadingMode);
643643
}
644-
catch (NpgsqlException)
644+
catch (PostgresException)
645645
{
646646
if (CurrentReader != null)
647647
{
@@ -664,7 +664,7 @@ async Task<IBackendMessage> ReadMessageWithPrependedAsync(CancellationToken canc
664664

665665
async Task<IBackendMessage> DoReadMessageAsync(CancellationToken cancellationToken, DataRowLoadingMode dataRowLoadingMode = DataRowLoadingMode.NonSequential, bool isPrependedMessage = false)
666666
{
667-
NpgsqlException error = null;
667+
PostgresException error = null;
668668
while (true)
669669
{
670670
var buf = ReadBuffer;
@@ -692,7 +692,7 @@ async Task<IBackendMessage> DoReadMessageAsync(CancellationToken cancellationTok
692692
Contract.Assert(msg == null);
693693
// An ErrorResponse is (almost) always followed by a ReadyForQuery. Save the error
694694
// and throw it as an exception when the ReadyForQuery is received (next).
695-
error = new NpgsqlException(buf);
695+
error = new PostgresException(buf);
696696
if (State == ConnectorState.Connecting)
697697
{
698698
// During the startup/authentication phase, an ErrorResponse isn't followed by
@@ -857,7 +857,7 @@ async Task<bool> ReadInternalAsync(CancellationToken cancellationToken)
857857
}
858858
}
859859
}
860-
catch (NpgsqlException)
860+
catch (PostgresException)
861861
{
862862
_state = ReaderState.Consumed;
863863
throw;

src/Npgsql/Npgsql.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<Compile Include="NpgsqlLargeObjectStream.cs" />
171171
<Compile Include="NpgsqlBinaryExporter.cs" />
172172
<Compile Include="NpgsqlBinaryImporter.cs" />
173-
<Compile Include="NpgsqlNotice.cs" />
173+
<Compile Include="PostgresNotice.cs" />
174174
<Compile Include="NpgsqlRawCopyStream.cs" />
175175
<Compile Include="FrontendMessages\CancelRequestMessage.cs" />
176176
<Compile Include="FrontendMessages\ExecuteMessage.cs" />
@@ -247,7 +247,7 @@
247247
<Compile Include="NpgsqlConnectorPool.cs" />
248248
<Compile Include="NpgsqlDataAdapter.cs" />
249249
<Compile Include="NpgsqlDataReader.cs" />
250-
<Compile Include="NpgsqlException.cs" />
250+
<Compile Include="PostgresException.cs" />
251251
<Compile Include="NpgsqlFactory.cs" />
252252
<Compile Include="Common.cs" />
253253
<Compile Include="NpgsqlNotificationEventArgs.cs" />
@@ -299,4 +299,4 @@
299299
<EmbeddedResource Include="NpgsqlMetaData.xml" />
300300
</ItemGroup>
301301
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
302-
</Project>
302+
</Project>

src/Npgsql/NpgsqlBinaryImporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public void Cancel()
337337
// The CopyFail should immediately trigger an exception from the read above.
338338
_connector.Break();
339339
throw new Exception("Expected ErrorResponse when cancelling COPY but got: " + msg.Code);
340-
} catch (NpgsqlException e) {
340+
} catch (PostgresException e) {
341341
if (e.SqlState == "57014") { return; }
342342
throw;
343343
}

src/Npgsql/NpgsqlCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ public override async Task<int> ExecuteNonQueryAsync(CancellationToken cancellat
943943
{
944944
return await ExecuteNonQueryInternalAsync(cancellationToken).ConfigureAwait(false);
945945
}
946-
catch (NpgsqlException e)
946+
catch (PostgresException e)
947947
{
948948
if (e.SqlState == "57014")
949949
throw new TaskCanceledException(e.Message);
@@ -1002,7 +1002,7 @@ public override async Task<object> ExecuteScalarAsync(CancellationToken cancella
10021002
{
10031003
return await ExecuteScalarInternalAsync(cancellationToken).ConfigureAwait(false);
10041004
}
1005-
catch (NpgsqlException e)
1005+
catch (PostgresException e)
10061006
{
10071007
if (e.SqlState == "57014")
10081008
throw new TaskCanceledException(e.Message);
@@ -1074,7 +1074,7 @@ protected async override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBeha
10741074
{
10751075
return await ExecuteDbDataReaderInternalAsync(behavior, cancellationToken).ConfigureAwait(false);
10761076
}
1077-
catch (NpgsqlException e)
1077+
catch (PostgresException e)
10781078
{
10791079
if (e.SqlState == "57014")
10801080
throw new TaskCanceledException(e.Message);

src/Npgsql/NpgsqlConnector.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ IBackendMessage ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode =
896896
ReceiveTimeout = UserTimeout;
897897
return DoReadMessage(dataRowLoadingMode);
898898
}
899-
catch (NpgsqlException)
899+
catch (PostgresException)
900900
{
901901
if (CurrentReader != null)
902902
{
@@ -921,7 +921,7 @@ IBackendMessage ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode =
921921
IBackendMessage DoReadMessage(DataRowLoadingMode dataRowLoadingMode = DataRowLoadingMode.NonSequential,
922922
bool isPrependedMessage = false)
923923
{
924-
NpgsqlException error = null;
924+
PostgresException error = null;
925925

926926
while (true)
927927
{
@@ -954,7 +954,7 @@ IBackendMessage DoReadMessage(DataRowLoadingMode dataRowLoadingMode = DataRowLoa
954954

955955
// An ErrorResponse is (almost) always followed by a ReadyForQuery. Save the error
956956
// and throw it as an exception when the ReadyForQuery is received (next).
957-
error = new NpgsqlException(buf);
957+
error = new PostgresException(buf);
958958

959959
if (State == ConnectorState.Connecting) {
960960
// During the startup/authentication phase, an ErrorResponse isn't followed by
@@ -1024,7 +1024,7 @@ IBackendMessage ParseServerMessage(ReadBuffer buf, BackendMessageCode code, int
10241024
HandleParameterStatus(buf.ReadNullTerminatedString(), buf.ReadNullTerminatedString());
10251025
return null;
10261026
case BackendMessageCode.NoticeResponse:
1027-
FireNotice(new NpgsqlNotice(buf));
1027+
FireNotice(new PostgresNotice(buf));
10281028
return null;
10291029
case BackendMessageCode.NotificationResponse:
10301030
FireNotification(new NpgsqlNotificationEventArgs(buf));
@@ -1257,7 +1257,7 @@ internal void ClearTransaction()
12571257
/// </summary>
12581258
internal event NotificationEventHandler Notification;
12591259

1260-
void FireNotice(NpgsqlNotice e)
1260+
void FireNotice(PostgresNotice e)
12611261
{
12621262
var notice = Notice;
12631263
if (notice != null)
@@ -1578,7 +1578,7 @@ internal void EndUserAction()
15781578
{
15791579
Contract.Requires(CurrentReader == null);
15801580
Contract.Ensures(!IsInUserAction);
1581-
Contract.EnsuresOnThrow<NpgsqlException>(!IsInUserAction);
1581+
Contract.EnsuresOnThrow<PostgresException>(!IsInUserAction);
15821582
Contract.EnsuresOnThrow<IOException>(!IsInUserAction);
15831583

15841584
if (!IsInUserAction)

src/Npgsql/NpgsqlDataReader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ bool ReadInternal()
249249
}
250250
}
251251
}
252-
catch (NpgsqlException)
252+
catch (PostgresException)
253253
{
254254
_state = ReaderState.Consumed;
255255
throw;
@@ -324,7 +324,7 @@ public sealed override bool NextResult()
324324
{
325325
return IsSchemaOnly ? NextResultSchemaOnly() : NextResultInternal();
326326
}
327-
catch (NpgsqlException e)
327+
catch (PostgresException e)
328328
{
329329
_state = ReaderState.Consumed;
330330
e.Statement = _statements[_statementIndex];
@@ -346,7 +346,7 @@ public sealed override async Task<bool> NextResultAsync(CancellationToken cancel
346346
? await NextResultSchemaOnlyAsync(cancellationToken).ConfigureAwait(false)
347347
: await NextResultInternalAsync(cancellationToken).ConfigureAwait(false);
348348
}
349-
catch (NpgsqlException e)
349+
catch (PostgresException e)
350350
{
351351
_state = ReaderState.Consumed;
352352
e.Statement = _statements[_statementIndex];

src/Npgsql/NpgsqlLargeObjectManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ internal int ExecuteFunctionGetBytes(string function, byte[] buffer, int offset,
100100
}
101101

102102
/// <summary>
103-
/// Create an empty large object in the database. If an oid is specified but is already in use, an NpgsqlException will be thrown.
103+
/// Create an empty large object in the database. If an oid is specified but is already in use, an PostgresException will be thrown.
104104
/// </summary>
105105
/// <param name="preferredOid">A preferred oid, or specify 0 if one should be automatically assigned</param>
106106
/// <returns>The oid for the large object created</returns>
107-
/// <exception cref="NpgsqlException">If an oid is already in use</exception>
107+
/// <exception cref="PostgresException">If an oid is already in use</exception>
108108
[RewriteAsync]
109109
public uint Create(uint preferredOid = 0)
110110
{

src/Npgsql/NpgsqlRawCopyStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public void Cancel()
235235
_connector.Break();
236236
throw new Exception("Expected ErrorResponse when cancelling COPY but got: " + msg.Code);
237237
}
238-
catch (NpgsqlException e)
238+
catch (PostgresException e)
239239
{
240240
if (e.SqlState == "57014") { return; }
241241
throw;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace Npgsql
4848
#if NET45 || NET451 || DNX451
4949
[Serializable]
5050
#endif
51-
public sealed class NpgsqlException : DbException
51+
public sealed class PostgresException : DbException
5252
{
5353
readonly ErrorOrNoticeMessage _msg;
5454
Dictionary<string, object> _data;
@@ -205,7 +205,7 @@ public sealed class NpgsqlException : DbException
205205

206206
#endregion
207207

208-
internal NpgsqlException(ReadBuffer buf)
208+
internal PostgresException(ReadBuffer buf)
209209
{
210210
_msg = new ErrorOrNoticeMessage(buf);
211211
}
@@ -241,7 +241,7 @@ where p.GetValue(_msg) != null
241241

242242
#region Serialization
243243
#if NET45 || NET451 || DNX451
244-
NpgsqlException(SerializationInfo info, StreamingContext context) : base(info, context)
244+
PostgresException(SerializationInfo info, StreamingContext context) : base(info, context)
245245
{
246246
_msg = (ErrorOrNoticeMessage)info.GetValue("msg", typeof(ErrorOrNoticeMessage));
247247
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Npgsql
3838
/// <remarks>
3939
/// http://www.postgresql.org/docs/current/static/protocol-flow.html#PROTOCOL-ASYNC
4040
/// </remarks>
41-
public class NpgsqlNotice
41+
public class PostgresNotice
4242
{
4343
readonly ErrorOrNoticeMessage _msg;
4444

@@ -170,7 +170,7 @@ public class NpgsqlNotice
170170

171171
#endregion
172172

173-
internal NpgsqlNotice(ReadBuffer buf)
173+
internal PostgresNotice(ReadBuffer buf)
174174
{
175175
_msg = new ErrorOrNoticeMessage(buf);
176176
}
@@ -184,9 +184,9 @@ public class NpgsqlNoticeEventArgs : EventArgs
184184
/// <summary>
185185
/// The Notice that was sent from the database.
186186
/// </summary>
187-
public NpgsqlNotice Notice { get; private set; }
187+
public PostgresNotice Notice { get; private set; }
188188

189-
internal NpgsqlNoticeEventArgs(NpgsqlNotice notice)
189+
internal NpgsqlNoticeEventArgs(PostgresNotice notice)
190190
{
191191
Notice = notice;
192192
}

0 commit comments

Comments
 (0)