diff src/org/tmatesoft/hg/core/HgUpdateConfigCommand.java @ 427:31a89587eb04

FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 29 Mar 2012 17:14:35 +0200
parents 9c9c442b5f2e
children e31e85cf4d4c
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgUpdateConfigCommand.java	Wed Mar 28 19:34:37 2012 +0200
+++ b/src/org/tmatesoft/hg/core/HgUpdateConfigCommand.java	Thu Mar 29 17:14:35 2012 +0200
@@ -27,7 +27,6 @@
 import org.tmatesoft.hg.internal.Experimental;
 import org.tmatesoft.hg.internal.Internals;
 import org.tmatesoft.hg.repo.HgInternals;
-import org.tmatesoft.hg.repo.HgInvalidFileException;
 import org.tmatesoft.hg.repo.HgRepository;
 
 /**
@@ -112,6 +111,11 @@
 		throw new UnsupportedOperationException();
 	}
 	
+	/**
+	 * Perform config file update
+	 * 
+	 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state
+	 */
 	public void execute() throws HgException {
 		try {
 			ConfigFile cfg = new ConfigFile();
@@ -132,7 +136,8 @@
 			}
 			cfg.writeTo(configFile);
 		} catch (IOException ex) {
-			throw new HgInvalidFileException("Failed to update configuration file", ex, configFile);
+			String m = String.format("Failed to update configuration file %s", configFile);
+			throw new HgBadArgumentException(m, ex); // TODO [post-1.0] better exception, it's not bad argument case
 		}
 	}