Show error message to user

AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2011

Hi

In my plugin there is a point that users can get a exception like "Strinh index out of bounds"

Right now it just stack trace on the screen:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1938)
 
Is there a way we show messages to user instead of showing a stack trace.
 Please let me know.
Thanks
Abe

4 answers

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2011

Depends on what your plugin is. Is it a validator? They have ways to return a nice message to the user. For things like listeners and post-function, there's no feedback (other than a stack dump) because you're not expected to handle it.

0 votes
AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2011

Exactly Nic. I am catching but how do I show users a friendly message. In my plugin user enters a string I take the string process it and show results.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2011

The programmer in me is screaming for you to catch the cases that cause the string to go out of bounds and either prevent it or code a proper response to it.

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2011

It depends on the context, for workflow actions etc yes, for services or listeners etc, no. So it depends what type of plugin you have.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events