1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

* simplify mediainfo error messages

This commit is contained in:
Reinhard Pointner 2015-06-19 16:27:29 +00:00
parent 745ac54c16
commit 4a2f093e92
2 changed files with 6 additions and 8 deletions

View File

@ -39,7 +39,7 @@ public class MediaInfo implements Closeable {
try {
handle = MediaInfoLibrary.INSTANCE.New();
} catch (LinkageError e) {
throw new MediaInfoException();
throw new MediaInfoException(e);
}
}

View File

@ -4,16 +4,14 @@ import com.sun.jna.Platform;
public class MediaInfoException extends RuntimeException {
public MediaInfoException() {
super(String.format("Unable to load %d-bit native library 'mediainfo'", Platform.is64Bit() ? 64 : 32));
}
public MediaInfoException(LinkageError e) {
super(String.format("Unable to load %d-bit native library 'mediainfo'", Platform.is64Bit() ? 64 : 32), e);
super(getLinkageErrorMessage(e));
}
public MediaInfoException(String msg, Throwable e) {
super(msg, e);
private static String getLinkageErrorMessage(LinkageError e) {
String name = Platform.isWindows() ? "MediaInfo.dll" : Platform.isMac() ? "libmediainfo.dylib" : "libmediainfo.so";
String arch = System.getProperty("os.arch").toLowerCase().trim();
return String.format("Unable to load %s native library %s", arch, name);
}
}