Skip to main content

Struct Diagnostic

Namespace: OceanApocalypse.RSML.Toolchain.Abstractions.Diagnostics
Assembly: RSML.Toolchain.Abstractions.dll

A diagnostic reported by RSML's API.

public readonly struct Diagnostic : IFormattable, IEquatable<Diagnostic>

Implements

IFormattable, IEquatable<Diagnostic>

Inherited Members

Object.Equals(Object?), Object.Equals(Object?, Object?), Object.GetHashCode(), Object.GetType(), Object.ReferenceEquals(Object?, Object?), Object.ToString()

Constructors

Diagnostic(String)

Creates a new diagnostic with a basic error code.

public Diagnostic(String code)

Parameters

code String

The error code.

Diagnostic(String, String)

Creates a new diagnostic.

public Diagnostic(String code, String message)

Parameters

code String

The error code.

message String

A brief error message detailing why it has happened.

Diagnostic(String, Severity)

Creates a new diagnostic.

public Diagnostic(String code, Severity severity)

Parameters

code String

The error code.

severity Severity

The error's severity.

Diagnostic(String, String, Severity)

Creates a new diagnostic.

public Diagnostic(String code, String message, Severity severity)

Parameters

code String

The error code.

message String

A brief error message detailing why it has happened.

severity Severity

The error's severity.

Diagnostic(String, SourceSpan, String, Severity)

Creates a new diagnostic.

public Diagnostic(String code, SourceSpan span, String message, Severity severity)

Parameters

code String

The error code.

span SourceSpan

The span the error relates to.

message String

A brief error message detailing why it has happened.

severity Severity

The error's severity.

Properties

Code

The error's code. Contains information about the category of the error.

public String Code { get; }

Property Value

String

IsInternal

Checks whether the error is internal (API error results, for example).

public Boolean IsInternal { get; }

Property Value

Boolean

Message

A brief error message detailing why it has happened.

public String Message { get; }

Property Value

String

Severity

The error's severity.

public Severity Severity { get; }

Property Value

Severity

Span

The span the error relates to.

public SourceSpan Span { get; }

Property Value

SourceSpan

Methods

Equals(Object?)

Indicates whether this instance and a specified object are equal.

public override Boolean Equals(Object? obj)

Parameters

obj Object?

The object to compare with the current instance.

Returns

Boolean

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(Diagnostic)

Indicates whether the current object is equal to another object of the same type.

public Boolean Equals(Diagnostic other)

Parameters

other Diagnostic

An object to compare with this object.

Returns

Boolean

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override Int32 GetHashCode()

Returns

Int32

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns a generic string representation of the current instance.

public override String ToString()

Returns

String

The string representation.

ToString(String?, IFormatProvider?)

Given a format, tries to return a string that uses said format as a basis for the representation. If it fails, it defaults to ToString.

public String ToString(String? format, IFormatProvider? formatProvider)

Parameters

format String?

The format. Available formats are: CTOR (constructor-like string), LOG (output-ready format) and JSON (struct as JSON).

formatProvider IFormatProvider?

Unused. Don't bother assigning it anything.

Returns

String

The string representation.

Operators

operator ==(Diagnostic, Diagnostic)

Checks if two Diagnostics are equal to each other.

public static Boolean operator ==(Diagnostic left, Diagnostic right)

Parameters

left Diagnostic

right Diagnostic

Returns

Boolean

True if equals.

operator !=(Diagnostic, Diagnostic)

Checks if two Diagnostics are different from each other.

public static Boolean operator !=(Diagnostic left, Diagnostic right)

Parameters

left Diagnostic

right Diagnostic

Returns

Boolean

True if different.