mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-21 09:35:39 -05:00
Move managed parser into its own project (test code coverage) (#774)
* Created New ManagedBatchParser project in .NetStandard * Addressing PR Comments * Resolve 'No Repository' warning. * Move batch parser tests to integrations test project * Fix SLN file
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection
|
||||
{
|
||||
/// <summary>
|
||||
/// Captures extended information about a specific error and a retry
|
||||
/// </summary>
|
||||
public class SqlServerRetryError : SqlServerError
|
||||
{
|
||||
private int _retryCount;
|
||||
private int _errorCode;
|
||||
|
||||
public SqlServerRetryError(string message, Exception ex, int retryCount, int errorCode, ErrorSeverity severity)
|
||||
: base(ex, message, errorCode, severity)
|
||||
{
|
||||
_retryCount = retryCount;
|
||||
_errorCode = errorCode;
|
||||
}
|
||||
|
||||
public int RetryCount
|
||||
{
|
||||
get { return _retryCount; }
|
||||
}
|
||||
|
||||
public static string FormatRetryMessage(int retryCount, TimeSpan delay, Exception transientException)
|
||||
{
|
||||
string message = string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
Resources.RetryOnException,
|
||||
retryCount,
|
||||
delay.TotalMilliseconds.ToString(CultureInfo.CurrentCulture),
|
||||
transientException.ToString());
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string FormatIgnoreMessage(int retryCount, Exception exception)
|
||||
{
|
||||
string message = string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
Resources.IgnoreOnException,
|
||||
retryCount,
|
||||
exception.ToString());
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user