Show / Hide Table of Contents

Class AuException

The base exception class used in this library. Thrown when something fails and there is no better exception type for that failure.

public class AuException : Exception, ISerializable
Remarks

Some constructors support Windows API error code. Then AuException.Message will contain its error description. If the string passed to the constructor starts with "*", replaces the "*" with "Failed to ". If does not end with ".", appends ".".


Namespace: Au.Types
Assembly: Au.dll
Inheritance
object
Exception
AuException
AuWndException
InputDesktopException
Inherited Members
Exception.GetBaseException()
Exception.GetType()
Exception.ToString()
Exception.Data
Exception.HelpLink
Exception.HResult
Exception.InnerException
Exception.Source
Exception.StackTrace
Exception.TargetSite
Exception.SerializeObjectState

Constructors

Name Description
AuException(int, string, Exception)

Sets NativeErrorCode = (errorCode != 0) ? errorCode : lastError.code. Sets Message = message + " " + lastError.messageFor(NativeErrorCode).

AuException(string, Exception)

Sets Message = message (default "Failed."). Sets NativeErrorCode = 0.

Fields

Name Description
FormattedMessage

String created by FormatMessage, which should be called by the Message override if null. Initially null.

Properties

Name Description
Message

Gets error message.

NativeErrorCode

Gets the Windows API error code.

Methods

Name Description
FormatMessage(string, string)

Formats error message. Sets and returns FormattedMessage.

ThrowIfHresultNegative(int, string)

If errorCode is less than 0, throws AuException that includes the code and its message. More info: AuException.FormatMessage.

ThrowIfHresultNot0(int, string)

If errorCode is not 0, throws AuException that includes the code and its message. More info: AuException.FormatMessage.

Extension Methods

ExtMisc.ToStringWithoutStack(Exception)