Skip to content

Commit

Permalink
API: Fix error message with PUT requests for existing objects
Browse files Browse the repository at this point in the history
fixes #11396
  • Loading branch information
Michael Friedrich committed May 9, 2016
1 parent b8e911b commit 8a65c4a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/remote/configobjectutility.cpp
Expand Up @@ -111,8 +111,10 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
String path = GetObjectConfigPath(type, fullName);
Utility::MkDirP(Utility::DirName(path), 0700);

if (Utility::PathExists(path))
BOOST_THROW_EXCEPTION(ScriptError("Configuration file '" + path + "' already exists."));
if (Utility::PathExists(path)) {
errors->Add("Configuration file '" + path + "' already exists.");
return false;
}

std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
fp << config;
Expand Down

0 comments on commit 8a65c4a

Please sign in to comment.