registerError method

void registerError(
  1. String key,
  2. AlgorandError error
)

Register a new error supplier so the consumer can easily detect what caused the error to be thrown.

Since Algorand does not support error codes out of the box, we have to perform a check against the error message. For example, consider the following Algorand error message: "overspend (account ...)".

We can now easily create and register our own Algorand Error supplier based on a key "overspend" which occurs in the message string.

Implementation

void registerError(String key, AlgorandError error) {
  AlgorandFactory().registerError(key, error);
}