cancel
Showing results for 
Search instead for 
Did you mean: 

WD application getting exception's message of a CAF operation

Former Member
0 Kudos

Hello,

I have the following CAF application services operation:

@com.sap.caf.dt.CAFOperation(name = "getSid")
public java.lang.String getSid(java.lang.Short letter, java.lang.String type)
		throws com.sap.caf.rt.exception.CAFRetrieveException {
	
	Sistema sis = this.getsistemaService().readByCustomKeys(letter, type);
	
	if (sis == null){
		return "Sid not found!";
	} else {
		return sis.getDescricao();
	}
}

and the following web dynpro application method:

public void executetesteAplicServiceServiceLocal_getSid( )  {
	//@@begin executetesteAplicServiceServiceLocal_getSid()
	//$$begin Service Controller01(1934885311)
	try
	{
	  wdContext.currentRequest_testeAplicServiceServiceLocal_getSidElement().modelObject().execute();
	  wdContext.nodeResponse_2().invalidate();
	}
	catch(EJBModelExecuteException e)
	{
	  wdComponentAPI.getMessageManager().reportException(e.getMessage());
	}

	//$$end
	//@@end
}

The WD application is using the CAF operation and when the CAF operation doesn't find the data it throws a CAFRetrieveException, but the message of this exception is not caught by the WD application because it's catching an EJBModelExecuteException. The message caught is always null.

I'd like to know how to get the exception's message that is throwable by the CAF application services?

Thanks.

Fabio

Accepted Solutions (1)

Accepted Solutions (1)

former_member185029
Active Contributor
0 Kudos

Why don't you try replacing EJBModelExecuteException with Exception?

Atleast you will be able to track what exception is being thrown.

Although I do not recommend to keep it as it is in your final solution, this will help you find the exact problem.

-Ashutosh

Answers (2)

Answers (2)

former_member214651
Active Contributor
0 Kudos

Hi,

Use a try / catch block to print the error message in ur CAF operation. in the catch block print the whole stack trace:

try
{
//coding
}
catch(Exception e)
{
e.printStackTrace();
}

this will print the entire message.

Regards,

Poojith MV

Former Member
0 Kudos

Hi Fabio,

i am having a similar problem, the exception is not thrown correctly, it always throwns EJBModelExecuteException, but i want to throw either the original or thisone but with the right information.

have you solved the problem?

thanks