Custom Exceptions in BizTalk

Introduction

Think about a scenario in which we receive a response from a stored procedure and if the response is an error, we need to abort the transaction with a custom error message and route it to the catch block. We can accomplish this using custom error handling in BizTalk.

Steps:

In the orchestration code block where you need to capture the custom error, place an expression shape.

 



Now insert the below line of code in the Expression shape:

objException=new System.Exception(insertStatus);

 

"ObjException" is a variable of type 'System.Exception'



Below the expression shape, place a 'Throw Exception' shape with an exception object of 'ObjException.'



By doing this, we are throwing a custom exception, and the catch block will capture the custom errors and process them as configured in the catch block.

Comments

Popular posts from this blog

EDI X12 Trading partner configuration in BizTalk

How to create an EDI 850 profile in Boomi?

Basics of Correlation in BizTalk