Skip to content

Commit

Permalink
Github warning fixes, removal of some other warnings related to rethr…
Browse files Browse the repository at this point in the history
…owing exceptions
  • Loading branch information
sfc-gh-mhofman committed Jan 30, 2024
1 parent dbbb98a commit 9133cc1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
11 changes: 6 additions & 5 deletions Snowflake.Data/Client/SnowflakeDbException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ public sealed class SnowflakeDbException : DbException
static private ResourceManager rm = new ResourceManager("Snowflake.Data.Core.ErrorMessages",
typeof(SnowflakeDbException).Assembly);

public string SqlState { get; private set; }

private string _sqlState;
public override string SqlState => _sqlState;

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AZURE)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AZURE)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AWS)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, AWS)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AWS)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AWS)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AZURE)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, AZURE)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, GCP)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net472, GCP)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, GCP)

'SnowflakeDbException.SqlState': no suitable method found to override

Check failure on line 27 in Snowflake.Data/Client/SnowflakeDbException.cs

View workflow job for this annotation

GitHub Actions / Tests on Windows (net471, GCP)

'SnowflakeDbException.SqlState': no suitable method found to override

private int VendorCode;

public string QueryId { get; set; }
Expand All @@ -40,7 +41,7 @@ public override int ErrorCode
public SnowflakeDbException(string sqlState, int vendorCode, string errorMessage, string queryId)
: base(FormatExceptionMessage(errorMessage, vendorCode, sqlState, queryId))
{
SqlState = sqlState;
_sqlState = sqlState;
VendorCode = vendorCode;
QueryId = queryId;
}
Expand All @@ -62,7 +63,7 @@ public SnowflakeDbException(string sqlState, SFError error, params object[] args
: base(FormatExceptionMessage(error, args, sqlState, string.Empty))
{
VendorCode = error.GetAttribute<SFErrorAttr>().errorCode;
SqlState = sqlState;
_sqlState = sqlState;
}

public SnowflakeDbException(Exception innerException, SFError error, params object[] args)
Expand All @@ -75,7 +76,7 @@ public SnowflakeDbException(Exception innerException, string sqlState, SFError e
: base(FormatExceptionMessage(error, args, sqlState, string.Empty), innerException)
{
VendorCode = error.GetAttribute<SFErrorAttr>().errorCode;
SqlState = sqlState;
_sqlState = sqlState;
}

static string FormatExceptionMessage(SFError error,
Expand Down
12 changes: 8 additions & 4 deletions Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,9 @@ private int GetFileTransferMaxBytesInMemory()
{
return int.Parse(maxBytesInMemoryString);
}
catch (Exception e)
catch (Exception)

Check warning on line 712 in Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs#L712

Added line #L712 was not covered by tests
{
Logger.Warn("Default for FILE_TRANSFER_MEMORY_THRESHOLD used due to invalid session value.");

Check warning on line 714 in Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs#L714

Added line #L714 was not covered by tests
return FileTransferConfiguration.DefaultMaxBytesInMemory;
}
}
Expand Down Expand Up @@ -1278,7 +1279,8 @@ private async Task<SFFileMetadata> UploadSingleFileAsync(
}
catch (Exception ex)
{
throw ex;
Logger.Error("UploadSingleFileAsync encountered an error: " + ex.Message);
throw;

Check warning on line 1283 in Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs#L1282-L1283

Added lines #L1282 - L1283 were not covered by tests
}
finally
{
Expand Down Expand Up @@ -1315,7 +1317,8 @@ private SFFileMetadata DownloadSingleFile(
}
catch (Exception ex)
{
throw ex;
Logger.Error("DownloadSingleFile encountered an error: " + ex.Message);
throw;
}
finally
{
Expand Down Expand Up @@ -1352,7 +1355,8 @@ private async Task<SFFileMetadata> DownloadSingleFileAsync(
}
catch (Exception ex)
{
throw ex;
Logger.Error("DownloadSingleFileAsync encountered an error: " + ex.Message);
throw;

Check warning on line 1359 in Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/FileTransfer/SFFileTransferAgent.cs#L1358-L1359

Added lines #L1358 - L1359 were not covered by tests
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions Snowflake.Data/Core/SFBindUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private void CreateStage()
{
session.SetArrayBindStageThreshold(0);
logger.Error("Failed to create temporary stage for array binds.", e);
throw e;
throw;

Check warning on line 300 in Snowflake.Data/Core/SFBindUploader.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/SFBindUploader.cs#L300

Added line #L300 was not covered by tests
}
}
}
Expand All @@ -321,7 +321,7 @@ internal async Task CreateStageAsync(CancellationToken cancellationToken)
{
session.SetArrayBindStageThreshold(0);
logger.Error("Failed to create temporary stage for array binds.", e);
throw e;
throw;

Check warning on line 324 in Snowflake.Data/Core/SFBindUploader.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Core/SFBindUploader.cs#L324

Added line #L324 was not covered by tests
}
}
}
Expand Down

0 comments on commit 9133cc1

Please sign in to comment.