Eric Sosman
6/14/2016 3:31:00 PM
On 6/14/2016 7:59 AM, Eric Douglas wrote:
> On Tuesday, June 14, 2016 at 6:34:06 AM UTC-4, Martin Gregorie wrote:
>> Your code summarises it pretty nicely. All I'd add is that the user needs
>> to know what happened, so if the program uses GUI interface it should log
>> the error[1] and report it to the user using a JOptionPane or similar. If
>> its a command-line (headless) program it should log the error[1] and
>> inform the user by writing one or more lines to System.err. In both cases
>> it can simply terminate after its reported what happened.
>
> We add an email to IT with a screenshot and full details of the error on all our crash logs.
(I hope your users "opt in" to this surveillance. Screen shots may
reveal information the user might have preferred to keep private, as in
the case of Congressional candidate Mike Webb.)
But back to the original question: After you've logged or reported
or dissected or whatevered the error condition, what next? Swallow the
exception and System.exit(), or re-throw the exception from main()? For
myself, I'd find System.exit() noticeably *worse* than throwing, since
it makes your main() harder to call from places other than JVM startup.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM