@@ -168,7 +168,7 @@ protected void configure() {
168168 .map ("healthy" ::equals )
169169 .orElse (false );
170170 } catch (IOException e ) {
171- logger ().error ("Unable to parse response {}" , response );
171+ logger ().error ("Unable to parse response {}" , response , e );
172172 return false ;
173173 }
174174 })
@@ -337,10 +337,10 @@ private void configureIndexer() {
337337 * Based on the user-configured bucket definitions, creating buckets and corresponding indexes if needed.
338338 */
339339 private void createBuckets () {
340- logger ().debug ("Creating " + buckets . size () + " buckets (and corresponding indexes)." );
340+ logger ().debug ("Creating {} buckets (and corresponding indexes)." , buckets . size () );
341341
342342 for (BucketDefinition bucket : buckets ) {
343- logger ().debug ("Creating bucket \" " + bucket .getName () + " \" " );
343+ logger ().debug ("Creating bucket \" {} \" " , bucket .getName ());
344344
345345 @ Cleanup Response response = doHttpRequest (MGMT_PORT , "/pools/default/buckets" , "POST" , new FormBody .Builder ()
346346 .add ("name" , bucket .getName ())
@@ -382,7 +382,7 @@ private void createBuckets() {
382382
383383 checkSuccessfulResponse (queryResponse , "Could not create primary index for bucket " + bucket .getName ());
384384 } else {
385- logger ().info ("Primary index creation for bucket " + bucket . getName () + " ignored, since QUERY service is not present." );
385+ logger ().info ("Primary index creation for bucket {} ignored, since QUERY service is not present." , bucket . getName () );
386386 }
387387 }
388388 }
@@ -406,7 +406,16 @@ private String getInternalIpAddress() {
406406 */
407407 private void checkSuccessfulResponse (final Response response , final String message ) {
408408 if (!response .isSuccessful ()) {
409- throw new IllegalStateException (message + ": " + response .toString ());
409+ String body = null ;
410+ if (response .body () != null ) {
411+ try {
412+ body = response .body ().string ();
413+ } catch (IOException e ) {
414+ logger ().debug ("Unable to read body of response: {}" , response , e );
415+ }
416+ }
417+
418+ throw new IllegalStateException (message + ": " + response .toString () + ", body=" + (body == null ? "<null>" : body ));
410419 }
411420 }
412421
0 commit comments