• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

Comparing Throwable

I have this in my java code

Throwable t = Status.getException();

Status.getException returns OperationCanceledException.

Is there a way of comaring throwables like strings.

I want to check if the throwable is OperationCanceledException. IF yes.Put a message.


How do i accomplish this.



0
rashmi_be
Asked:
rashmi_be
  • 3
  • 2
1 Solution
 
TrekkyLeaperCommented:
If i understand correctly, you just want to do this:

if( t instanceof OperationCanceledException ) {
  //do what you want if it is
} else {
  // do what you want if it isn't
}
0
 
rashmi_beAuthor Commented:
no t is not an instance of OperationCanceledException
0
 
TrekkyLeaperCommented:
t is a Throwable, but instanceof will check to see if the actual value (whatever was returned from the getException method call). If I am still misunderstanding, please post more information.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
sciuriwareCommented:
TrekkyLeaper is right; read the books!
;JOOP!
0
 
sciuriwareCommented:
ok
0
 
TrekkyLeaperCommented:
Thanks, Venabili.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now