(info) This AI is still in early stages of development.

Error Dialect

A specific dialect for reporting errors within Babel...

 

Overview

Various errors can occur when AIs start speaking to each other, including:

  • Game objects being destroyed before the recipient gets a message
  • Processing a non-Babel message, or message corruption
  • Any other weirdness that might happen

If an error occurs before a message is sent, the message won't get sent – your code should put Error Handling around chat.toBabel() to trap the error and thus decide how to handle the situation.

On the receiving end, if an error is generated during chat.fromBabel(), the return array will contain details of the error as follows:

[sender, to, errorMessage, "error", chatMsg]

Where:

  • sender, to = values of parameters of same name you passed in to chat.fromBabel()
  • errorMessage = a string containing a description of the error
  • "error" = indicates the error dialect is being used
  • chatMsg = the original message received in eventChat()

Assuming your script uses a switch statement to decide how to process different dialects, you can either:

  • Check for the "error" dialect and act accordingly (eg. re-throw the error or send it to debug(), etc)
  • Not check for the "error' dialect and basically ignore any errors

Up to you what you do (wink)

Availability BETA

Requires:

Contents

Jump to:

Babel API

Topics: