cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Extracting Complete Exception Messages in SAP Cloud Integration (CPI)

naveen4796
Explorer
0 Kudos

Hi,

I would like to address an issue we are currently facing in our integration scenario and seek your assistance

1. integration Scenario

The integration scenario involves transferring data between two systems via a CPI interface/iFlow. If an exception occurs during the data transfer, I need to extract the exception information and send the error details back to the source system.

2. Current Issue

In our current setup, ODATA adapter is used to load/extract the data with the receiver system. However, when an exception occurs like shown in the screenshot "image.1.1" below, we face a challenge. The highlighted error message can only be viewed by enabling/running the interface in trace mode.

Unfortunately, neither the CamelExceptionCaught nor the ${exception.message} properties capture/return the following error info.

<em>"cause: org.apache.olingo.odata2.api.edm.EdmSimpleTypeException: The metadata constraints '[MaxLength=8]' do not allow to format the value '999120222'."</em>

image.1.1: Exception message, when checked in trace mode

image.1.2: Exception info stored in CamelExceptionCaught Property

It doesn't capture the critical cause error, like highlighted in the above screenshot

3. Expectation

Extract the complete exception message, including the cause information highlighted above, so that I can send it back to the source system for further action.

Can you please assist me with extracting the complete exception message?

Regards,

Naveen

Accepted Solutions (0)

Answers (1)

Answers (1)

saranya_baskaran2
Participant

The exception is wrapped in multiple layers and hence to get the exact exception use the below script in the exeception Sub Process.

def exception = propertiesMap.get("CamelExceptionCaught");
def errorMessage = exception.getCause().getCause().getCause().getMessage();

The error String will contain -> The metadata constraints '[Nullable=false, MaxLength=15, FixedLength=false, Unicode=true]' do not allow to format the value 'abcdefghijklmnopqrstuvwxyz' for property 'CategoryName'.