cancel
Showing results for 
Search instead for 
Did you mean: 

raiseException() deprecated, what use instead?

Former Member
0 Kudos

Hi,

in Netweaver 7.1 CE the method wdComponentAPI.getMessageManager().raiseException

is deprecated.

Question 1:

What should be used in instead? Javadoc says use ReportException in combination with a checked Exception. How should I use this?

Question 2:

Can I stop the execution of the application in wdDoInit of a Controller?

Best regards,

Peter

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Peter,

Question 1:

wdComponentAPI.getMessageManager().reportException(arg); 
arg- may be  String or Exception;

You can stop the navigation using this code.

wdComponentAPI.getMessageManager().cancelNavigation();

Question 2:

Yes, you can stop the execution of the application.

return;

Feel free to revert in case of issues.

Regards,

Siva

Former Member
0 Kudos

HI,

okay, Question 1 is answered.

But the return doesn't stop the execution of the Application, it just avoids that the actual method will be executed any longer.

Best Regard,

Peter

former_member197348
Active Contributor
0 Kudos

Hi Peter,

Can I stop the execution of the application in wdDoInit of a Controller?

What do you exactly want?

Do you want to terminate the application or stop the execution of the method?

To stop the execution of the method, we can use return like this:

if (condition){
		return;
	   }

We can terminate the application also using WDClientUser.forceLogoffClientUser(url);

Feel free to revert to in case of issues.

Regards,

Siva

Former Member
0 Kudos

HI,

I want to stop the execution of the whole Application.

Thanks for your help, this method works.

Best regards,

Peter

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

in the method tab you can add custom exceptions to your method, the caller of your method than needs to deal with the exception. Like this:

public void myMethod throws CustomException

try {
myMethod();
}
catch(CustomException e)
{ // well ****, here we are
wdComponentAPI.getMessageManager().reportException(e.getMessage());
}
finally {
// do what needs to be done
}

As for stopping the whole application, I think its a better solution to handle the error and stop code from being executed with if conditions.

Former Member
0 Kudos

HI,

but how can I do this in the wdDoInit Method of a Controller?

Most of the raiseExceptions Methods from the Code are in wdDoInit Methods.

Thanks for your help.

Best Regards,

Peter