Changeset 74396 in vbox for trunk/src/VBox/Runtime/common/rest
- Timestamp:
- Sep 20, 2018 10:39:39 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 125220
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/rest/RTCRestClientResponseBase.cpp
r74251 r74396 336 336 337 337 338 void RTCRestClientResponseBase::deserializeBody( RTCRestObjectBase *a_pDst, const char *a_pchData, size_t a_cbData)338 void RTCRestClientResponseBase::deserializeBody(const char *a_pchData, size_t a_cbData, const char *a_pszBodyName) 339 339 { 340 340 if (m_strContentType.startsWith("application/json")) … … 348 348 if (RT_SUCCESS(rc)) 349 349 { 350 PrimaryJsonCursorForBody PrimaryCursor(hValue, a_p Dst->typeName(), this); /* note: consumes hValue */351 a_pDst->deserializeFromJson(PrimaryCursor.m_Cursor);350 PrimaryJsonCursorForBody PrimaryCursor(hValue, a_pszBodyName, this); /* note: consumes hValue */ 351 deserializeBodyFromJsonCursor(PrimaryCursor.m_Cursor); 352 352 } 353 353 else if (RTErrInfoIsSet(&ErrInfo.Core)) 354 354 addError(rc, "Error %Rrc parsing server response as JSON (type %s): %s", 355 rc, a_p Dst->typeName(), ErrInfo.Core.pszMsg);355 rc, a_pszBodyName, ErrInfo.Core.pszMsg); 356 356 else 357 addError(rc, "Error %Rrc parsing server response as JSON (type %s)", rc, a_p Dst->typeName());357 addError(rc, "Error %Rrc parsing server response as JSON (type %s)", rc, a_pszBodyName); 358 358 } 359 359 else if (rc == VERR_INVALID_UTF8_ENCODING) 360 360 addError(VERR_REST_RESPONSE_INVALID_UTF8_ENCODING, "Invalid UTF-8 body encoding (object type %s; Content-Type: %s)", 361 a_p Dst->typeName(), m_strContentType.c_str());361 a_pszBodyName, m_strContentType.c_str()); 362 362 else if (rc == VERR_BUFFER_UNDERFLOW) 363 363 addError(VERR_REST_RESPONSE_EMBEDDED_ZERO_CHAR, "Embedded zero character in response (object type %s; Content-Type: %s)", 364 a_p Dst->typeName(), m_strContentType.c_str());364 a_pszBodyName, m_strContentType.c_str()); 365 365 else 366 366 addError(rc, "Unexpected body validation error (object type %s; Content-Type: %s): %Rrc", 367 a_p Dst->typeName(), m_strContentType.c_str(), rc);367 a_pszBodyName, m_strContentType.c_str(), rc); 368 368 } 369 369 else 370 370 addError(VERR_REST_RESPONSE_CONTENT_TYPE_NOT_SUPPORTED, "Unsupported content type for '%s': %s", 371 a_pDst->typeName(), m_strContentType.c_str()); 372 } 373 371 a_pszBodyName, m_strContentType.c_str()); 372 } 373 374 375 void RTCRestClientResponseBase::deserializeBodyFromJsonCursor(RTCRestJsonCursor const &a_rCursor) 376 { 377 a_rCursor.m_pPrimary->addError(a_rCursor, VERR_REST_INTERNAL_ERROR_8, "deserializeBodyFromJsonCursor must be overridden!"); 378 AssertFailed(); 379 } 380
Note:
See TracChangeset
for help on using the changeset viewer.