本文整理汇总了C#中ErrorCodes类的典型用法代码示例。如果您正苦于以下问题:C# ErrorCodes类的具体用法?C# ErrorCodes怎么用?C# ErrorCodes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorCodes类属于命名空间,在下文中一共展示了ErrorCodes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: S2CRes
public S2CRes(SerialFormat format, double execTime, ErrorCodes res, object objectToSerialize)
: this(format, execTime, res)
{
this.m_objectToSerialize = objectToSerialize;
Data = objectToSerialize;
ContentType = S2CContentType.Obj;
}
示例2: CustomErrorActionResult
public CustomErrorActionResult(HttpRequestMessage request, string message, ErrorCodes errorCode, HttpStatusCode status)
{
this.Request = request;
this.Message = message;
this.ErrorCode = errorCode;
this.Status = status;
}
示例3: ThrowError
public static void ThrowError(ErrorCodes code, params object[] args)
{
switch (code)
{
// <Native>
case ErrorCodes.AlreadyLoaded:
throw new AlreadyLoadedException(code, args);
case ErrorCodes.SteamInitializeFailed:
throw new SteamInitializeFailedException(code, args);
case ErrorCodes.SteamInterfaceInitializeFailed:
throw new SteamInterfaceInitializeFailedException(code, args);
// </Native>
// <Managed>
case ErrorCodes.InvalidInterfaceVersion:
throw new InvalidInterfaceVersionException(code, args);
case ErrorCodes.UsageAfterAPIShutdown:
throw new UsageAfterAPIShutdownException(code, args);
case ErrorCodes.CallbackStructSizeMissmatch:
throw new CallbackStructSizeMismatchException(code, args);
// </Managed>
}
if (code >= ErrorCodes.StartOfNativeErrors && code <= ErrorCodes.EndOfNativeErrors)
{
throw new NativeException(code);
}
if (code >= ErrorCodes.StartOfManagedErrors && code <= ErrorCodes.EndOfManagedErrors)
{
throw new ManagedException(code);
}
throw new UnexpectedException(code);
}
示例4: Fail
public Fail(ErrorCodes errorCode, string formatString, params object[] args)
{
if (formatString == null) throw new ArgumentNullException(nameof(formatString));
ErrorCode = errorCode;
ErrorMessage = string.Format(formatString, (object[])args);
}
示例5: TimeOutException
protected TimeOutException(ErrorCodes code, string message, ConsistencyLevel consistencyLevel, int received, int blockFor)
: base(code, message)
{
ConsistencyLevel = consistencyLevel;
Received = received;
BlockFor = blockFor;
}
示例6: DaqException
internal DaqException(string errorMessage, ErrorCodes errorCode)
: base(errorMessage)
{
m_errorCode = errorCode;
m_level = ErrorLevel.Error;
m_lastResponse = null;
}
示例7: ReadScanData
protected void ReadScanData(ErrorCodes errorCode, CallbackType callbackType, object callbackData)
{
int availableSamples = (int)callbackData;
double[,] scanData;
try
{
scanData = Device.ReadScanData(availableSamples, 0);
int channels = scanData.GetLength(0);
int samples = scanData.GetLength(1);
DataDisplay = String.Empty;
for (int i = 0; i < Math.Min(100, samples); i++)
{
for (int j = 0; j < channels; j++)
{
DataDisplay += scanData[j, i].ToString("F03") + " ";
}
DataDisplay += Environment.NewLine;
}
ScanDataTextBox.Text = DataDisplay;
}
catch (Exception ex)
{
Stop = true;
statusLabel.Text = ex.Message;
}
}
示例8: Error
/// <summary>
/// Prints the message and the stack trace of the exception on the standard
/// error output stream.
/// </summary>
/// <param name="message">The error message.</param>
/// <param name="e">The exception.</param>
/// <param name="errorCode">The internal error code.</param>
public void Error(string message, Exception e, ErrorCodes errorCode)
{
if (m_firstTime)
{
m_firstTime = false;
LogLog.Error("[" + m_prefix + "] " + message, e);
}
}
示例9: SafeGetString
private static string SafeGetString(ErrorCodes id)
{
if (errorStrings.ContainsKey(id))
{
return errorStrings[id];
}
return id.ToString();
}
示例10: ErrorData
/// <summary>
/// Initialises a new instance of the ErrorData class.
/// </summary>
/// <param name="errorCode">
/// Error code. Must be defined in <see cref="ErrorCodes"/>.
/// </param>
public ErrorData(ushort errorCode)
{
if (!Enum.IsDefined(typeof(ErrorCodes), (int)errorCode))
{
throw new Exception("Invalid error code.");
}
ErrorCode = (ErrorCodes)errorCode;
}
示例11: ApiException
public ApiException(ErrorCodes code, string message, string devMessage = null, HttpStatusCode statusCode = HttpStatusCode.InternalServerError, Exception innerException = null, string correlationId = null, object details = null)
: base(string.Format("{0}. {1}", code, message), innerException)
{
FaultCode = code;
StatusCode = statusCode;
CorrelationId = correlationId ?? Guid.NewGuid().ToString("N");
Details = details;
DeveloperMessage = BuildDevMsg(InnerException, devMessage);
}
示例12: GetMessage
internal static string GetMessage(ErrorCodes code)
{
switch (code)
{
case ErrorCodes.UserExist:
return @"User with specified username already exist";
case ErrorCodes.UsernameEmpty:
return @"Empty username is not allowed";
}
return null;
}
示例13: Main
/// <summary>
/// Main entry point for the application
/// </summary>
/// <param name="args">Commandline arguments. see /help for documentation</param>
/// <returns>0 if sucseed, otherwise a value below 0. see error codes in documentation</returns>
public static int Main(string[] args)
{
ConsoleAdapter.TryAttach();
int returnCode = 0;
try
{
new ProgramHandler().DoApplication(args);
}
catch (RegAddinException exception)
{
new ExceptionPresenter().ShowError(exception);
returnCode = exception.ReturnCode;
}
catch (UnauthorizedAccessException exception)
{
new ExceptionPresenter().ShowError(exception);
returnCode = new ErrorCodes().SetLastError(exception).CodeFromName("UnauthorizedAccess");
}
catch (System.Security.SecurityException exception)
{
new ExceptionPresenter().ShowError(exception);
returnCode = new ErrorCodes().SetLastError(exception).CodeFromName("MissingPermissions");
}
catch (Exception exception)
{
new ExceptionPresenter().ShowError(exception);
returnCode = new ErrorCodes().SetLastError(exception).CodeFromName("UnexpectedError");
}
if (SingletonSettings.Alert == SingletonSettings.AlertMode.On ||
SingletonSettings.Alert == SingletonSettings.AlertMode.Error && returnCode != 0)
{
if (returnCode == 0)
Alert.Window.ShowSucceedMessage();
else
Alert.Window.ShowError(new ErrorCodes().MessageDetailsFromCode(returnCode));
}
return returnCode;
}
示例14: _errorPage_ErrorClose
private void _errorPage_ErrorClose(bool hardFail)
{
if (hardFail || _prevPage == null)
Close();
else
{
_lastError = ErrorCodes.SUCCESS;
_lastException = null;
RestorePrevPage();
_showingError = false;
}
}
示例15: ShowError
private void ShowError(ErrorCodes code, Exception ex, bool showLast = false)
{
if (transitionControl.CurrentPage != _errorPage)
{
if(showLast && _lastError != ErrorCodes.SUCCESS)
{
ShowErrorPage(_lastError, _lastException);
}
else if (code != ErrorCodes.SUCCESS && ex != null)
{
if(Errors.IsHardFail(code))
{
ShowErrorPage(code, ex);
}
else
{
_lastError = code;
_lastException = ex;
mainBar.ShowError(Errors.GetErrorMessage(code));
if (transitionControl.CurrentPage == _loadingPage && !_lastFMAuth)
{
_loginPage.LoginFailed = true;
transitionControl.ShowPage(_loginPage);
}
}
}
}
}