Skip to content

Commit

Permalink
Bugfix: update the exception type to error (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou9584 authored Aug 16, 2023
1 parent b3eab00 commit 7de45c6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ public HandledErrorLog createErrorLog(final Thread thread, final Throwable throw

/* Uncaught exception or managed exception. */
errorLog.setFatal(fatal);
if (!fatal) {
errorLog.setType(HandledErrorLog.TYPE);
}

/* Application launch time. */
errorLog.setAppLaunchTimestamp(simpleDateFormat.format(new Date(initializeTimestamp)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,26 @@ public void sendErrorLogTest() throws Exception {
appCenterClient.send(handledErrorLog);

}

@Test
public void sendWarnLogTest() throws Exception {
boolean mockHttpClient = false;
if (StringUtils.isBlank(appCenterToken)) {
appCenterToken = "test";
// and we need to mock the http request
mockHttpClient = true;
}
AppCenterClient appCenterClient = new AppCenterClient(appCenterToken, "agent", "0.0.0", "000000");

if (mockHttpClient) {
appCenterClient.httpClient = MockUtil.mockOkHttpClient("{}");
}

HandledErrorLog handledErrorLog = appCenterClient.createErrorLog(Thread.currentThread(), new HydraLabRuntimeException("sendWarnLogTest exception"), false);

System.out.println(JSON.toJSONString(handledErrorLog, SerializerFeature.PrettyFormat));

appCenterClient.send(handledErrorLog);

}
}

0 comments on commit 7de45c6

Please sign in to comment.