cancel
Showing results for 
Search instead for 
Did you mean: 

How to know if a LookupException is recoverable or not

Former Member
0 Kudos

After doing a SOAP lookup in a UDF I'd like to catch any possible exception and check if it's recoverable or not, to do a different treatment:

...

SystemAccessor accessor = LookupService.getSystemAccessor(channel);

...

Payload payload = accessor.call(payloadIn); // This is the call that may throw LookupException

Checking the API (http://help.sap.com/javadocs/pi/SP3/xpi/index.html?com/sap/aii/mapping/lookup/LookupException.html), I don't think that is possible to find out if the LookupException created automatically by PI is recoverable or not, which I find very strange.

Am I right?

Accepted Solutions (0)

Answers (2)

Answers (2)

GabrielSagaya
Active Contributor
0 Kudos

Hi,

Please use try catch block and trace the Exception in the catchBlock.

try {

...

SystemAccessor accessor = LookupService.getSystemAccessor(channel);

...

Payload payload = accessor.call(payloadIn);

.....

} catch (LookupException e) {

trace.addWarning("Error during lookup - " + e);

}

https://wiki.sdn.sap.com/wiki/display/Snippets/User-definedMappingFunctionforRFC+Lookup

Former Member
0 Kudos

Gabriel,

printing the trace is not the solution. I have to know if it's recoverable or not, and act accordingly in the code.

Thanks

former_member181962
Active Contributor
0 Kudos

Hi Jorge,

I see your problem now.

I think you are right when you said there are no java functions that would get the recoverable/not recoverable information.

YOu should probably raise an OSS and see what SAP says.

Did you try to use the getStackTrace() method to see if that information is embedded somewhere in between?

Regards,

Ravi

Former Member
0 Kudos

Hi,

Yes this is recoverable (as API said).

Use any of the constructor (From API):

LookupException(String message, boolean recoverable) : Constructs a new exception with the specified detail message and the specified recoverable attribute value.

LookupException(String message, Throwable cause, boolean recoverable) : Constructs a new exception with the specified detail message, cause, and the specified recoverable attribute value.

LookupException(Throwable cause, boolean recoverable): Constructs a new exception with the specified recoverable attribute value, the specified cause and a detail message of (cause==null ?

U can record recover the instances in the catch block in case of an exception and then recover later.

catch(Exception e)

{

LookupException le = new <constuctor u want to use>

// your code

}

Regards,

Gourav

former_member181962
Active Contributor
0 Kudos

Hi Jorge,

The document that you have provided, says that it does "adds an attribute which differs between a "recoverable" and permanent exception indicating whether it makes sense to repeat the previous lookup call."

Is it not something you are looking for?

I'm slightly confused with your question.

Can you rephrase your question?

Thanks and Regards,

ravi

Former Member
0 Kudos

Hi Ravi,

I have in my code the call to the SOAP lookup like this:

try{

...

Payload payload = accessor.call(payloadIn);

} catch (LookupException e) {

??

}

I'd like to check in ?? if the exception captured, e, is recoverable or not (for example, if the web service I'm calling is down, PI will create automatically a LookupException). But I don't seem to have in the API something like e.isRecoverable() or something similar.