Skip to content

interfaces errors

abc edited this page Jun 23, 2024 · 2 revisions

Errors

All properties and classes about global error handling reside in this object.

1. Properties

1.1. ErrorCodes

Name to integer mapping that shortly describes the error codes used in HBError class. Current value of this property is as follows:

const ErrorCodes = {
  Empty: 0, // ""
  ConnectionClosed: 1, // 'Connection closed$1?(" $1":"")'
  GameStateTimeout: 2, // "Game state timeout"
  RoomClosed: 3, // "The room was closed."
  RoomFull: 4, // "The room is full."
  WrongPassword: 5, // "Wrong password."
  BannedBefore = 6, // "You are banned from this room."
  IncompatibleVersion = 7, // "Incompatible game version."
  FailedHost = 8, // "Failed to connect to room host. If this problem persists please see the troubleshooting guide: https://github.com/haxball/haxball-issues/wiki/Connection-Issues"
  Unknown = 9, // "An error ocurred while attempting to join the room.<br><br>This might be caused by a browser extension, try disabling all extensions and refreshing the site.<br><br>The error has been printed to the inspector console."
  Cancelled = 10, // "Cancelled"
  FailedPeer = 11, // "Failed to connect to peer."
  KickedNow = 12, // 'You were $2?("banned":"kicked")$3?(" by $3":"")$1?(" ($1)":"")'
  Failed = 13, // "Failed"
  MasterConnectionError = 14, // "Master connection error"
  StadiumParseError = 15, // 'Error in "$1" index: $2'
  StadiumParseSyntaxError = 16, // "SyntaxError in line: $1"
  StadiumParseUnknownError = 17, // "Error loading stadium file."
  ObjectCastError = 18, // "Cannot cast $1 to $2"
  TeamColorsReadError = 19, // "too many"
  UTF8CharacterDecodeError = 20, // "Cannot decode UTF8 character at offset $1: charCode ($2) is invalid"
  ReadTooMuchError = 21, // "Read too much"
  ReadWrongStringLengthError = 22, // "Actual string length differs from the specified: $1 bytes"
  EncodeUTF8CharNegativeError = 23, // "Cannot encode UTF8 character: charCode ($1) is negative"
  EncodeUTF8CharTooLargeError = 24, // "Cannot encode UTF8 character: charCode ($1) is too large (>= 0x80000000)"
  CalculateLengthOfUTF8CharNegativeError = 25, // "Cannot calculate length of UTF8 character: charCode ($1) is negative"
  CalculateLengthOfUTF8CharTooLargeError = 26, // "Cannot calculate length of UTF8 character: charCode ($1) is too large (>= 0x80000000)"
  BufferResizeParameterTooSmallError = 27, // "Can't resize buffer to a capacity lower than 1"
  BadColorError = 28, // "Bad color"
  BadTeamError = 29, // "Bad team value"
  StadiumLimitsExceededError = 30, // "Error"
  MissingActionConfigError = 31, // "Class doesn't have a config"
  UnregisteredActionError = 32, // "Tried to pack unregistered action"
  MissingImplementationError = 33, // "missing implementation"
  AnnouncementActionMessageTooLongError = 34, // "message too long"
  ChatActionMessageTooLongError = 35, // "message too long"
  KickBanReasonTooLongError = 36, // "string too long"
  ChangeTeamColorsInvalidTeamIdError = 37, // "Invalid team id"
  MissingRecaptchaCallbackError = 38, // "Recaptcha requested. Either set onRequestRecaptcha or set a working token while creating/joining a room."
  ReplayFileVersionMismatchError = 39, // "The replay data is of a different version"
  ReplayFileReadError = 40, // "Couldn't load replay data."
  JoinRoomNullIdAuthError = 41, // "id and authObj cannot be null. (inside 1st parameter)"
  PlayerNameTooLongError = 42, // "name too long"
  PlayerCountryTooLongError = 43, // "country too long"
  PlayerAvatarTooLongError = 44, // "avatar too long"
  PlayerJoinBlockedByMPDError = 45, // "Player join not allowed: $3 $4 $5 $1 $2"
  PlayerJoinBlockedByORError = 46, // "Player join event blocked by OperationReceived: $1"
  PluginNotFoundError = 47, // "Plugin not found at index $1"
  PluginNameChangeNotAllowedError = 48, // "Plugin name should not change"
  LibraryNotFoundError = 49, // "Library not found at index $1"
  LibraryNameChangeNotAllowedError = 50, // "Library name should not change"
  AuthFromKeyInvalidIdFormatError = 51, // "Invalid id format"
  BadActorError = 55, // "Bad Actor"
  AuthBannedError = 56, // "Auth banned: $1"
  NoProxyIdentityProblem = 57, // "Basro's backend is not compatible with the login system, so the identity token and identity events are disabled."
  NoProxyIdentitySolution = 58 // "Solution: Use a proxy server and handle the login data there."
}

2. Classes

2.1. HBError

This is the class that is instantiated while any error is being thrown from the API.

2.1.1. Properties

  • code: int: The error code that has been thrown.
  • params: object[]: Parameters for the error.

2.1.2. Functions

  • toString(): string

    Returns the full description of the current error object depending on the API's current language.

    Parameters: None.

    Return value: Full description of this error object in the API's current language.

Clone this wiki locally