Skip to content

Commit 881b9cc

Browse files
Copilottrask
andcommitted
Add endpoints that throw exceptions to smoke test for exception message handling
Co-authored-by: trask <[email protected]>
1 parent 05b825c commit 881b9cc

File tree

1 file changed

+19
-0
lines changed
  • smoke-tests/apps/ExceptionMessageHandling/src/main/java/com/microsoft/applicationinsights/smoketestapp

1 file changed

+19
-0
lines changed

smoke-tests/apps/ExceptionMessageHandling/src/main/java/com/microsoft/applicationinsights/smoketestapp/TestController.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,23 @@ public String testExceptionWithWhitespaceMessage(HttpServletResponse response) {
4040
logger.error("Exception with whitespace message test", new IllegalArgumentException(" "));
4141
return "Exception logged";
4242
}
43+
44+
@GetMapping("/throwExceptionWithoutMessage")
45+
public String throwExceptionWithoutMessage() throws Exception {
46+
// This reproduces the original issue by throwing exceptions without messages
47+
// that would cause 206 errors from Application Insights service
48+
throw new NullPointerException();
49+
}
50+
51+
@GetMapping("/throwExceptionWithEmptyMessage")
52+
public String throwExceptionWithEmptyMessage() throws Exception {
53+
// Test throwing exception with empty message
54+
throw new RuntimeException("");
55+
}
56+
57+
@GetMapping("/throwExceptionWithWhitespaceMessage")
58+
public String throwExceptionWithWhitespaceMessage() throws Exception {
59+
// Test throwing exception with whitespace-only message
60+
throw new IllegalArgumentException(" ");
61+
}
4362
}

0 commit comments

Comments
 (0)