Jump to content
  • Advertisement
Sign in to follow this  

Java Throw Exception

This topic is 2222 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an application which excepts a username and password input from the user. Then attempts a network connection, 3 classes deep from my form events (the view). So deep in my networking connection I want to throw and Exception and log some text for the user to see. So..

with in this method I have something like..

public boolean doAConnect() throws Exception
//check invalid usernamepassword here...
if (errorCode == invalidUsernamePass)
throw new Exception("Invalid Username and Password);

the problem is that in my view when I use the try/catch, I am getting a "Java.lang.exception error: <error message here>". I only want the error message I set! Any ideas how I can just show the message to the user without the "Java.lang.Exception error:" pre-pended onto my string?

catch(Exception e)
Edited by Instigator

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!