Skip to content

Exception ?

Summary

  • Internal name: AndromateException
  • Category: Workflow Runtime
  • Purpose: Check whether the last executed task raised an exception, and optionally capture its error details into variables.
  • Task type: Conditional

Compatibility

  • Minimum AndroMate version: 1.1.0

  • Maximum AndroMate version: 1.1.0

  • Minimum Android: Android 13 (API 33)

  • Maximum Android tested: Android 16 (API 36)

  • Supported manufacturers:

    • ✅ All manufacturers
  • Required permissions:

    • None

Detailed description

The Exception ? task inspects the execution context to determine whether the last executed task produced an exception. It is a conditional task: it evaluates to true or false and routes the workflow into one of two branches accordingly.

It is used to:

  • Detect failures in the previous task without stopping the workflow
  • Branch into an error-handling path or a success path
  • Capture the error code, description, and failing task ID for reporting
  • Build resilient workflows that recover from task errors

The task handles:

  • reading the last exception state from the shared AndroMateContext,
  • evaluating the boolean result (true = error, false = no error),
  • optionally writing exception details into declared workflow variables.

Input parameters

This task has no input parameters. It reads the exception state directly from the execution context.


Output parameters

The output variables are optional. If a variable name is provided and the variable was declared in the Start node, its value is updated after execution.

Field Type Condition Android Compatibility AndroMate Compatibility Default
code_output String When the previous task failed Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
description_output String When the previous task failed Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>
task_id_output String When the previous task failed Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 <ANDROMATE_NULL_VALUE>

Exceptions

The Exception ? task does not raise any exceptions of its own.


Execution flowchart

flowchart TD
    Start([Start CheckExceptionTask]) --> ReadCtx[📋 Read AndroMateContext\ngetLastExceptionDto]

    ReadCtx --> Evaluate{lastTaskHasError ?}

    Evaluate -->|true| SetTrue[conditionResult = true\nException detected]
    Evaluate -->|false| SetFalse[conditionResult = false\nNo exception]

    SetTrue --> UpdateVars[💾 Update output variables\nif declared in context:\ncode_output\ndescription_output\ntask_id_output]
    SetFalse --> ReturnFalse([↪ FALSE branch\nWorkflow continues normally])

    UpdateVars --> ReturnTrue([↪ TRUE branch\nWorkflow goes to error handler])

    style Start fill:#e3f2fd
    style ReturnTrue fill:#ffcdd2
    style ReturnFalse fill:#c8e6c9
    style Evaluate fill:#fff9c4
    style UpdateVars fill:#fff9c4

How it works:

  1. Read context: Retrieves the last exception DTO from AndroMateContext
  2. Evaluate: Calls lastTaskHasError() — returns true if the previous task failed, false otherwise
  3. Update variables (only on true): If output variable names are provided and declared in Start, writes the error code, description, and failing task ID into them
  4. Route: The graph engine reads the boolean result and follows the "true" or "false" link

Output parameter details

1. Output variable: code_output

Stores the error code of the exception raised by the previous task.

Example

"code_output": "$error_code"

Details

  • Only populated when the condition result is true (previous task failed).
  • The variable must have been declared in the Start node.

2. Output variable: description_output

Stores the human-readable description of the exception.

Example

"description_output": "$error_desc"

3. Output variable: task_id_output

Stores the ID of the task that raised the exception.

Example

"task_id_output": "$failed_task_id"

Details

  • Useful to identify which task failed when multiple tasks precede this check.

Complete JSON example

{
  "AndromateException": [
    {
      "id": "2",
      "title": "Exception ?",
      "code_output": "$error_code",
      "description_output": "$error_desc",
      "task_id_output": "$failed_task_id"
    }
  ]
}