Skip to content

Class CommandSyntaxException

Namespace: Void.Minecraft.Commands.Brigadier.Exceptions
Assembly: Void.Minecraft.dll

Represents a command parsing or execution syntax failure with optional input context.

public class CommandSyntaxException : Exception, ISerializable

Inheritance

objectExceptionCommandSyntaxException

Implements

ISerializable

Inherited Members

Exception.GetBaseException(), Exception.GetType(), Exception.ToString(), Exception.Data, Exception.HelpLink, Exception.HResult, Exception.InnerException, Exception.Message, Exception.Source, Exception.StackTrace, Exception.TargetSite, Exception.SerializeObjectState, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

CommandSyntaxException(ICommandExceptionType, IMessage, string, int)

Represents a command parsing or execution syntax failure with optional input context.

public CommandSyntaxException(ICommandExceptionType type, IMessage message, string input = "", int cursor = -1)

Parameters

type ICommandExceptionType

The exception category.

message IMessage

The unformatted error message.

input string

The command input, or an empty string when unavailable.

cursor int

The failure position, or -1 when unavailable.

Fields

ContextAmount

Specifies the maximum number of input characters shown before the failure marker.

public const int ContextAmount = 10

Field Value

int

Properties

BuiltInExceptions

Gets or sets the global provider used by Brigadier parsing code.

public static IBuiltInExceptionProvider BuiltInExceptions { get; set; }

Property Value

IBuiltInExceptionProvider

Cursor

Gets the captured cursor position.

public int Cursor { get; }

Property Value

int

Input

Gets the captured command input.

public string Input { get; }

Property Value

string

Message

Gets the raw message augmented with cursor context when input is available.

public override string Message { get; }

Property Value

string

RawMessage

Gets the unformatted message object.

public IMessage RawMessage { get; }

Property Value

IMessage

Type

Gets the exception category.

public ICommandExceptionType Type { get; }

Property Value

ICommandExceptionType

Methods

GetContext()

Builds the input excerpt ending at the failure marker.

public string? GetContext()

Returns

string?

The excerpt, or null when the captured input is empty or whitespace.

GetMessage()

Builds the displayed error message.

public string GetMessage()

Returns

string

The raw message, followed by a position and context excerpt when available.