Class OnErrorHandler

java.lang.Object
scriptella.core.OnErrorHandler

public class OnErrorHandler extends Object
Error handler for scripting elements.

This class maintains an internal copy of onerrorElements for ScriptEl to allow calling onError(Throwable) several times with different return result.

Version:
1.0
Author:
Fyodor Kupolov
  • Constructor Details

    • OnErrorHandler

      public OnErrorHandler(ScriptEl scriptEl)
      Initialize error handler with the list of OnErrorEl.
      Parameters:
      scriptEl - scripting element configuration to get onerror info.
  • Method Details

    • onError

      public OnErrorEl onError(Throwable throwable)
      Called on error to get a OnErrorEl with fallback script.

      Note: The returned OnErrorEl element is removed from internal list of elements to avoid handling the same error condition twice.

      Parameters:
      throwable -
      Returns:
      OnErrorEl matching error condition.
    • getErrorCodes

      protected Set<String> getErrorCodes(Throwable t)
      Parameters:
      t - throwables chain.
      Returns:
      not null set of found error codes in throwable chain.