# HG changeset patch # User David Barts # Date 1586586156 25200 # Node ID 9ac6136c710cb74167994815e96a1ae70c4ad244 # Parent e52fd1a575de3551fdb509626be909e094fe3881 Replace the temporary error handling in Initialize.kt. diff -r e52fd1a575de -r 9ac6136c710c src/name/blackcap/exifwasher/exiv2/Initialize.kt --- a/src/name/blackcap/exifwasher/exiv2/Initialize.kt Fri Apr 10 20:58:03 2020 -0700 +++ b/src/name/blackcap/exifwasher/exiv2/Initialize.kt Fri Apr 10 23:22:36 2020 -0700 @@ -8,7 +8,12 @@ import java.io.IOException import java.util.jar.JarEntry import java.util.jar.JarFile +import java.util.logging.Level +import java.util.logging.Logger +import javax.swing.* +import name.blackcap.exifwasher.Application import name.blackcap.exifwasher.LF_DIR +import name.blackcap.exifwasher.LOGGER import name.blackcap.exifwasher.OS object Initialize { @@ -57,12 +62,14 @@ target.setLastModified(source.getTime()) } } catch (e: IOException) { + LOGGER.log(Level.SEVERE, "unable to create ${tPath}", e) val message = e.message ?: "I/O error" die("unable to create ${tPath}: ${message}") } try { System.load(tPath) } catch (e: UnsatisfiedLinkError) { + LOGGER.log(Level.SEVERE, "unable to link ${tPath}", e) val message = e.message ?: "unsatisfied link" die("unable to link ${tPath}: ${message}") } @@ -72,8 +79,10 @@ } private fun die(message: String) { - /* should open a dialog */ - System.err.println(message) + JOptionPane.showMessageDialog(Application.mainFrame, + "A fatal error occurred in initialization:\n${message}", + "Error", JOptionPane.ERROR_MESSAGE) + LOGGER.log(Level.SEVERE, "aborted due to fatal error") System.exit(1) } }