Skip to content

Commit

Permalink
Unbind an instance from the cluster.
Browse files Browse the repository at this point in the history
Embed the non-writable directory in the CannotWriteException for
sane debugging.
  • Loading branch information
jimwebber committed Oct 20, 2016
1 parent d975153 commit 2ac4646
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Expand Up @@ -19,10 +19,14 @@
*/
package org.neo4j.commandline.dbms;

public class CannotWriteException extends Exception
import java.nio.file.Path;

import static java.lang.String.format;

class CannotWriteException extends Exception
{
public CannotWriteException( String message )
CannotWriteException( Path file )
{
super(message);
super( format("Could not write to: %s", file.toAbsolutePath().toString() ));
}
}
Expand Up @@ -27,9 +27,9 @@
import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.kernel.internal.StoreLocker;

public class StoreLockChecker
class StoreLockChecker
{
public Closeable withLock( Path databaseDirectory ) throws CommandFailed, CannotWriteException
Closeable withLock( Path databaseDirectory ) throws CommandFailed, CannotWriteException
{
Path lockFile = databaseDirectory.resolve( StoreLocker.STORE_LOCK_FILENAME );
if ( Files.exists( lockFile ) )
Expand All @@ -44,7 +44,7 @@ public Closeable withLock( Path databaseDirectory ) throws CommandFailed, Cannot
}
else
{
throw new CannotWriteException( "Store is not writable. Check permissions and try again." );
throw new CannotWriteException( lockFile );
}
}
return () ->
Expand Down

0 comments on commit 2ac4646

Please sign in to comment.