i2psnark: Error messages take 2

This commit is contained in:
zzz
2019-11-25 13:36:48 +00:00
parent 9feeb76d6c
commit e1189b9c9f

View File

@ -467,7 +467,7 @@ public class Snark
try { storage.close(); } catch (IOException ioee) { try { storage.close(); } catch (IOException ioee) {
ioee.printStackTrace(); ioee.printStackTrace();
} }
fatal("Could not check or create storage for " + getBaseName(), ioe); fatal("Could not check or create files for " + getBaseInfo(), ioe);
} }
} }
@ -609,7 +609,7 @@ public class Snark
try { storage.close(); } catch (IOException ioee) { try { storage.close(); } catch (IOException ioee) {
ioee.printStackTrace(); ioee.printStackTrace();
} }
fatal("Could not reopen storage for " + getBaseName(), ioe); fatal("Could not open file for " + getBaseInfo(), ioe);
} }
} }
trackerclient.start(); trackerclient.start();
@ -710,6 +710,19 @@ public class Snark
return torrent; return torrent;
} }
/**
* @return base name for torrent [filtered version of getMetaInfo.getName()],
* or a fake name if in magnet mode, followed by path info and error message,
* for error logging only
* @since 0.9.44
*/
private String getBaseInfo() {
if (storage != null)
return storage.getBaseName() + " at " +
storage.getBase() + " - check that device is present and writable";
return torrent;
}
/** /**
* @return always will be valid even in magnet mode * @return always will be valid even in magnet mode
* @since 0.8.4 * @since 0.8.4
@ -1256,7 +1269,7 @@ public class Snark
} }
// TODO we're still in an inconsistent state, won't work if restarted // TODO we're still in an inconsistent state, won't work if restarted
// (PeerState "disconnecting seed that connects to seeds" // (PeerState "disconnecting seed that connects to seeds"
fatal("Could not create data files for " + getBaseName(), ioe); fatal("Could not create file for " + getBaseInfo(), ioe);
} }
} }