Error handling in Mendix

The default action for an error in a Mendix Microflow action is “Rollback”. This means that:

  • Every change made so far in the current Microflow will never have happened;
  • If the Microflow was called from another Microflow, the error will be passed back up to the parent Microflow as an error in that “Call Microflow” action and will be dealt with according to the error handling settings for that action;
  • If the Microflow was called from a user action (e.g. an action button), the error will be displayed to the user as a (not very detailed) error popup.
flowchart TD
    subgraph mf2[Microflow 2]
    direction LR
        Start2((Start)) -->
        C("Change C") -->
        D("Change D (Error)"):::Error -->
        E("Change E") -->
        End2((End))
    end

    subgraph mf1[Microflow 1]
    direction LR
        Start1((Start)) -->
        A("Change A (Commit)") -->
        B("Change B (Commit)") -->
        Call2[["Call 'Microflow 2'"]]:::Error --> 
        End1((End))
    end

    mf1 -.-> mf2

    classDef Error fill:white,stroke:darkred,color:darkred,stroke-width:2;
  1. “Microflow 1” is started by the user via an action button.
  2. “Change A” is made, as is “Change B”.
  3. “Microflow 1” calls “Microflow 2”.
  4. “Change C” is made, but then “Change D” throws an error.
  5. Everything in “Microflow 2” is now rolled back, so “Change C” never happened.
  6. The “Call ‘Microflow 2’” action in “Microflow 1” now returns an error.
  7. Everything in “Microflow 1” is now rolled back, so “Change B” and “Change A” never happened, even though “Change A” was committed.
  8. The user who clicked the action button now sees a generic error pop-up message.