cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to raise exception

Former Member
0 Kudos

Hi,

Can anyone help me in providing me the UDF / java code to raise exceptions and fail the mapping.

I can do it by usinf string out of bound exception to fail the mapping ( which is one of the way).

But i need to invoke the exception clause to throw the custom message.

Can anyone please throw some light on this could be helpful..

Thanks,

Sneha

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sneha,

You can use below code-


if (condition)
  	{ 	}

else throw new StreamTransformationException( "Custom Message");   

Regards,

Amol

former_member194786
Active Contributor
0 Kudos

Hi Sneha,

Please refer to the below blogs for this:

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping

Hope this is useful.

Regards,

Sanjeev.

former_member854360
Active Contributor
0 Kudos

Hi Sneha,


public String throwexception(String input, Container container) throws StreamTransformationException{
if(input.equals("ERROR"))
{
throw new RuntimeException("Mapping fail");
}
else
{
return input;
}
}

refer this

Also see,

Throwing Smart Exceptions in XI Graphical Mapping

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

XI/PI: Throwing Generic Exceptions from any type of Mapping

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping