Skip to content

Commit c134020

Browse files
committed
Clean up formatting
Clean up formatting
1 parent 82a1897 commit c134020

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

include/triton/common/triton_json.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ class TritonJson {
184184
std::string(GetParseError_En(document_.GetParseError())) + " at " +
185185
std::to_string(document_.GetErrorOffset())));
186186
}
187-
TRITONJSON_STATUSTYPE status = ParseErrorHandler(document_, std::string(base, size));
187+
TRITONJSON_STATUSTYPE status =
188+
ParseErrorHandler(document_, std::string(base, size));
188189
if (status != TRITONJSON_STATUSSUCCESS) {
189-
return status;
190+
return status;
190191
}
191192

192193
allocator_ = &document_.GetAllocator();
@@ -202,26 +203,26 @@ class TritonJson {
202203
// Helper function for Parse(const char* base, const size_t size) to handle
203204
// errors. Return error message if parsing failed.
204205
TRITONJSON_STATUSTYPE ParseErrorHandler(
205-
const rapidjson::Document& document, const std::string& json)
206-
{
207-
if (document.HasParseError()) {
208-
std::ostringstream error_stream;
209-
error_stream << "failed to parse the request JSON buffer: "
210-
<< GetParseError_En(document.GetParseError())
211-
<< " at offset " << document.GetErrorOffset() << ".";
212-
213-
// Show part of the JSON to help debugging
214-
const size_t preview_length = 100;
215-
std::string json_preview = json.substr(0, preview_length);
216-
if (json.size() > preview_length) {
217-
json_preview += "...";
218-
}
206+
const rapidjson::Document& document, const std::string& json)
207+
{
208+
if (document.HasParseError()) {
209+
std::ostringstream error_stream;
210+
error_stream << "failed to parse the request JSON buffer: "
211+
<< GetParseError_En(document.GetParseError())
212+
<< " at offset " << document.GetErrorOffset() << ".";
213+
214+
// Show part of the JSON to help debugging
215+
const size_t preview_length = 100;
216+
std::string json_preview = json.substr(0, preview_length);
217+
if (json.size() > preview_length) {
218+
json_preview += "...";
219+
}
219220

220-
error_stream << " JSON Preview: \"" << json_preview << "\"";
221+
error_stream << " JSON Preview: \"" << json_preview << "\"";
221222

222-
return TRITONJSON_STATUSRETURN(error_stream.str());
223-
}
224-
return TRITONJSON_STATUSSUCCESS;
223+
return TRITONJSON_STATUSRETURN(error_stream.str());
224+
}
225+
return TRITONJSON_STATUSSUCCESS;
225226
}
226227

227228
// Write JSON representation into a 'buffer' in a compact

0 commit comments

Comments
 (0)