@@ -168,7 +168,7 @@ public void testMaybeWrapListenerForStackTraceDebugLog() {
168168 new MockLog .ExceptionSeenEventExpectation (
169169 format ("\" [%s]%s: failed to execute search request\" and an exception logged" , nodeId , shardId ),
170170 SearchService .class .getCanonicalName (),
171- Level .DEBUG ,
171+ Level .DEBUG , // We will throw a 400-level exception, so it should only be logged at the debug level
172172 format ("[%s]%s: failed to execute search request" , nodeId , shardId ),
173173 IllegalArgumentException .class ,
174174 exceptionMessage
@@ -187,8 +187,7 @@ public void onFailure(Exception e) {
187187 mockLog .assertAllExpectationsMatched ();
188188 }
189189 };
190- // This is a 400-level exception, so it should only be debug logged
191- IllegalArgumentException e = new IllegalArgumentException (exceptionMessage );
190+ IllegalArgumentException e = new IllegalArgumentException (exceptionMessage ); // 400-level exception
192191 listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), nodeId , shardId , threadPool );
193192 listener .onFailure (e );
194193 }
@@ -205,7 +204,7 @@ public void testMaybeWrapListenerForStackTraceWarnLog() {
205204 new MockLog .ExceptionSeenEventExpectation (
206205 format ("\" [%s]%s: failed to execute search request\" and an exception logged" , nodeId , shardId ),
207206 SearchService .class .getCanonicalName (),
208- Level .WARN ,
207+ Level .WARN , // We will throw a 500-level exception, so it should be logged at the warn level
209208 format ("[%s]%s: failed to execute search request" , nodeId , shardId ),
210209 IllegalStateException .class ,
211210 exceptionMessage
@@ -224,8 +223,7 @@ public void onFailure(Exception e) {
224223 mockLog .assertAllExpectationsMatched ();
225224 }
226225 };
227- // This is a 400-level exception, so it should only be debug logged
228- IllegalStateException e = new IllegalStateException (exceptionMessage );
226+ IllegalStateException e = new IllegalStateException (exceptionMessage ); // 500-level exception
229227 listener = maybeWrapListenerForStackTrace (listener , TransportVersion .current (), nodeId , shardId , threadPool );
230228 listener .onFailure (e );
231229 }
0 commit comments