The MSPro Boomi Collection
About
Good Practices & Patterns
Good Practices & Patterns
  • Markus' Boomi Integration
  • Implementation Patterns
    • The Cache Challenge
      • The Get-Or-Create Use-Case
      • PropCache Scripts
    • State Management
      • Example Scenario
      • State-Management in general
      • State-Management Functionality
      • Technical Solutions
        • Boomi File-System Implementation
          • saveState
          • readState & fetchStates
    • Exception Handling
      • Exception vs Error
      • Basic Rules
        • Aggregating Exceptions
      • Exception Handling Pattern
        • User-Defined Exception Messages
        • Catch Exceptions
      • The pattern in practice
        • API Error Handling
          • Single Record Strategy
            • Single Record RES
          • Many Records Strategy (Array)
            • Many Records RES
        • Pre-Condition Check
    • SQL Patterns
      • Script Header
      • General Rules
        • Check using RowCount
        • Check if record exists
        • Pagination and Sorting
        • Parameter - Best Practices
        • Use JSON as a complex parameter
    • Process Patterns
      • Process Route Implementation Pattern
      • Sub-Process or Process Route
    • DateTime
      • The Boomi datetime dilemma
      • Database and Flow
      • Groovy
      • Data Hub
      • Get Current Date
    • Groovy Script Patterns
      • Dynamic Document Properties
      • Dynamic Process Properties
      • Documents
    • Array Elements to Documents
  • MSPro Services
    • Intermediate Storage
      • Example Processes
        • Docs 01 - Update and Create
          • sub.SampleData.Invoice
        • 02 - Upsert and Get
    • Render Templates
  • Tips
Powered by GitBook
On this page
  1. Implementation Patterns
  2. Exception Handling
  3. Basic Rules

Aggregating Exceptions

When more than one Try/Catch is needed

Last updated 1 year ago

Exception handling may become a bit more complex when a process must handle different contexts - when you need to aggregate Exceptions. A very common example is a CSV import process, that runs periodically and reads one or more files from sFTP to send each line to a backend-service.

A Try/Catch block works in the context of the Documents which flow through the Try block.

Initially, when the process starts, there is no document and the Try/Catch works in the process context (orange). Then you read the files from sFTP and a Try/Catch block works in the context of the files (green). Then you split the CSVs into rows and another Try/Catch block works in the context of the rows (blue).

It is important to understand that you catch (and collect) the Exceptions per context to forward (re-throw) an aggregated exception to the "previous" context. Finally, on the process Try/Catch you have got the aggregation of all Exceptions. And this is normally the place where you implement the aggregated Exception handler to send one e-mail.

An import process with different contexts
Three Try/Catch block - one for each context