Skip to content

Instantly share code, notes, and snippets.

@altimmons
Last active September 15, 2019 05:54
Show Gist options
  • Save altimmons/2e4f521150a39a8161024af862a89c6d to your computer and use it in GitHub Desktop.
Save altimmons/2e4f521150a39a8161024af862a89c6d to your computer and use it in GitHub Desktop.
Expects a String fileName
try {
//code
}catch(FileNotFoundException fnfE){
App.log.warning( "FileNotFoundException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( fnfE.getStackTrace() ) );
}catch( IOException ioE ){
App.log.warning( "IO Exception trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( ioE.getStackTrace() ) );
}catch( IllegalArgumentException iaE ){
App.log.warning( "IllegalArgumentException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( iaE.getStackTrace() ) );
}catch(SecurityException sE){
App.log.warning( "SecurityException trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( sE.getStackTrace() ) );
}catch(NullPointerException npE){
App.log.warning( "NullPointerException! trying to open file: " + Paths.get( fileName ).toAbsolutePath().toString() );
App.log.warning( String.valueOf( npE.getStackTrace() ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment