Interface MachineError

All Known Implementing Classes:
MachineError.Generic, MachineError.InsufficientResource, MachineError.InvalidConfiguration, MachineError.InvalidDefinition, MachineError.MissingResource, MachineError.SerializationError, MachineError.TransferRejected, MachineError.WrongThread

public interface MachineError
An expected failure, returned in a Result instead of thrown (ARCHITECTURE.md §25). Exceptions are reserved for programmer errors.

The standard families are the nested records. Addons can define their own errors by implementing this interface with a code() in their namespace.

  • Method Details

    • code

      @NotNull @NotNull net.kyori.adventure.key.Key code()
      Stable machine-readable code, e.g. machineengine:insufficient_resource.
    • message

      @NotNull @NotNull String message()
    • context

      @NotNull default @NotNull Map<String,Object> context()
      Debugging details.
    • format

      @NotNull default @NotNull String format()
    • of

      @NotNull static @NotNull MachineError of(@NotNull @NotNull net.kyori.adventure.key.Key code, @NotNull @NotNull String message)
    • details

      @NotNull static @NotNull Map<String,Object> details(@NotNull @NotNull Object... keyValues)
      Builds a context map from alternating keys and values.