diff --git a/src/utils.coffee b/src/utils.coffee index 526d33f..2e9b64e 100644 --- a/src/utils.coffee +++ b/src/utils.coffee @@ -44,8 +44,8 @@ utils.restoreDatabase = (connectionString, dirName, next) -> return next null, stdOut, stdErr utils.makeDumpCommand = (connectionString, dirName) -> - throw "No target directory given." unless dirName - throw "Target directory must be a string" unless typeof dirName is "string" + throw new Error "No target directory given." unless dirName + throw new Error "Target directory must be a string" unless typeof dirName is "string" connectionParameters = utils.parseConnectionString connectionString commandOptions = makeCommandOptions connectionParameters commandOptions.out = dirName @@ -54,8 +54,8 @@ utils.makeDumpCommand = (connectionString, dirName) -> "mongodump#{argumentString}" utils.makeRestoreCommand = (connectionString, dirName) -> - throw "No source directory given." unless dirName - throw "Source directory must be a string" unless typeof dirName is "string" + throw new Error "No source directory given." unless dirName + throw new Error "Source directory must be a string" unless typeof dirName is "string" actualDirName = utils.findDumpDirName dirName utils.log "Using #{actualDirName}" connectionParameters = utils.parseConnectionString connectionString @@ -122,4 +122,4 @@ makeCommandArguments = (options, object) -> makeArgumentString = (args) -> str = "" str += " '#{arg}'" for arg in args - str \ No newline at end of file + str