8000 Bug fix 3.5/fix view creation errors (#9599) · mhdprogrammer1/arangodb@40c27d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40c27d2

Browse files
authored
Bug fix 3.5/fix view creation errors (arangodb#9599)
* Fix ArangoSearch view creation errors * Fix another error
1 parent f995c46 commit 40c27d2

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

arangod/RestHandler/RestViewHandler.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,30 @@ void RestViewHandler::createView() {
166166
return;
167167
}
168168

169-
auto badParamError = [&]() -> void {
170-
generateError(rest::ResponseCode::BAD, TRI_ERROR_BAD_PARAMETER,
171-
"expecting body to be of the form {name: <string>, type: "
172-
"<string>, properties: <object>}");
173-
};
174-
175169
if (!body.isObject()) {
176-
badParamError();
170+
generateError(rest::ResponseCode::BAD, TRI_ERROR_BAD_PARAMETER,
171+
"request body is not an object");
177172
events::CreateView(_vocbase.name(), "", TRI_ERROR_BAD_PARAMETER);
178173
return;
179174
}
180175

181176
auto nameSlice = body.get(StaticStrings::DataSourceName);
182177
auto typeSlice = body.get(StaticStrings::DataSourceType);
183178

184-
if (!nameSlice.isString() || !typeSlice.isString()) {
185-
badParamError();
179+
if (!nameSlice.isString()) {
180+
generateError(rest::ResponseCode::BAD, TRI_ERROR_BAD_PARAMETER,
181+
"expecting name parameter to be of the form of \"name: "
182+
"<string>\"");
183+
events::CreateView(_vocbase.name(), "", TRI_ERROR_BAD_PARAMETER);
184+
return;
185+
}
186+
187+
if (!typeSlice.isString()) {
188+
generateError(rest::ResponseCode::BAD, TRI_ERROR_BAD_PARAMETER,
189+
"expecting type parameter to be of the form of \"type: "
190+
"<string>\"");
186191
events::CreateView(_vocbase.name(),
187-
(nameSlice.isString() ? nameSlice.copyString() : ""),
192+
nameSlice.copyString(),
188193
TRI_ERROR_BAD_PARAMETER);
189194
return;
190195
}

arangod/RestServer/ViewTypesFeature.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct InvalidViewFactory : public arangodb::ViewFactory {
4444
return arangodb::Result(
4545
TRI_ERROR_BAD_PARAMETER,
4646
std::string(
47-
"failure to create view without a factory for definition: ") +
47+
"invalid type provided to create view with definition: ") +
4848
definition.toString());
4949
}
5050

@@ -54,7 +54,7 @@ struct InvalidViewFactory : public arangodb::ViewFactory {
5454
return arangodb::Result(
5555
TRI_ERROR_BAD_PARAMETER,
5656
std::string(
57-
"failure to instantiate view without a factory for definition: ") +
57+
"invalid type provided to instantiate view with definition: ") +
5858
definition.toString());
5959
}
6060
};

0 commit comments

Comments
 (0)
0