Results 1 to 2 of 2
  1. #1
    johnmerlino is offline Member
    Join Date
    May 2014
    Posts
    56
    Rep Power
    0

    Default What to do when an exception occurs that affects functioniong of program

    When an exception occurs that will affect the entire functioning of a program, in other words, the program will not be able to do what it is intended to do, is it best just print the exception to user and run System.exit(1)? And then force the user to run the program again.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: What to do when an exception occurs that affects functioniong of program

    Depends what you mean by "the program will not be able to do what it is intended to do".

    For example, a simple GUI with a file selector designed for uploading a file to somewhere.
    If the file is not uploaded (eg a the connection doesn't work), that would count as "unable to do its work", in my book. But would you really want to force the user out of the app?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. java.lang.IllegalArgumentException error occurs
    By clint in forum New To Java
    Replies: 1
    Last Post: 12-01-2010, 04:37 PM
  2. Error 404 occurs while running Servlet
    By bala in forum Java Servlet
    Replies: 5
    Last Post: 09-12-2010, 06:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •