Error

public sealed class Error
A mutable collection of values representing information about some error.

Constructors

Error

#
public Error(string context, Exception exception = null)
Create a new error based on an exception.
context (string)
exception (Exception = null)

Properties

Actions

#
public List<ErrorAction> Actions { get; }
Gets the collection of actions this error exposes. Append actions to this collection to give the user tools for dealing with the error.

Context

#
public string Context { get; }
Gets the context or title for this error. This ought to inform the user of the area of code from which this error stems. The context may only be set from the constructor.

ErrorId

#
public Guid ErrorId { get; set; }
Gets or sets the Id of this error. Errors with non-zero Ids may be disabled by the user.

Exception

#
public Exception Exception { get; }
Gets the exception for this error, if any. The exception may only be assigned at construction.

Explanation

#
public string Explanation { get; set; }
Gets or sets the human-friendly explanation of this error. This is typically a translation of the Message field into basic human natural language.

Location

#
public string Location { get; set; }
Gets or sets the location text for this error. This would typically be the filename and linenumber of the exception: PluginServer.cs line 397

Message

#
public string Message { get; set; }
Gets or sets the message of this error. This is typically the same as the Exception.Message of the Exception associated with this error. It is meant to be exact and informative to the developer, not the user.

Origin

#
public string Origin { get; set; }
Gets or sets the origin text for this error. This would typically be the name of the type and method which threw the exception.

Suggestions

#
public string Suggestions { get; set; }
Gets or sets the suggestions for the user to respond to this error. This is typically a list of possible actions which the software cannot perform itself expressed in basic human natural language.

Methods

SetLocation

#
public void SetLocation(string file, int line)
Assign the Location field.
file (string)
line (int)

SetOrigin

#
public void SetOrigin(params string[] elements)
Assign the Origin field. This method automatically inserts dots between the elements.
elements (params string[])Namespace, type and method elements.

Show

#
public void Show(ErrorFields expandedFields = ErrorFields.Common)
Show this error.
expandedFields (ErrorFields = ErrorFields.Common)

Show

#
public void Show(PointF location, ErrorFields expandedFields = ErrorFields.Common)
Show this error.
location (PointF)
expandedFields (ErrorFields = ErrorFields.Common)

ShowModal

#
public void ShowModal(ErrorFields expandedFields = ErrorFields.Common)
Show this error and wait for it to be closed before returning.
expandedFields (ErrorFields = ErrorFields.Common)

ShowModal

#
public void ShowModal(PointF location, ErrorFields expandedFields = ErrorFields.Common)
Show this error and wait for it to be closed before returning.
location (PointF)
expandedFields (ErrorFields = ErrorFields.Common)