Commit 9ef776a
committed
[CSAPI]: Log more details on invalid requests
Previously, just the exception message was logged. For some exceptions,
this is quite non-descript, for example:
2024-01-25 06:17:14.061 DEBUG [SWAPool-1] - Invalid request (BAD_PAYLOAD): Invalid payload: Invalid XML: Received event END_DOCUMENT, instead of START_ELEMENT or END_ELEMENT.
To solve this error, a backtrace is needed to figure out what was
expected exactly.
This particular exception message could probably be improved by itself,
but this commit solves this more generically, since there might be other
exceptions suffering from the same issue.
This commit changes the handling of InvalidRequestExceptions to use the
existing `logError()` function. This logs details of the request and
a backtrace. To ensure that this does not log "Internal server error"
but keep the existing "Invalid request", `logError()` is refactored to
accept an error prefix.1 parent d111a69 commit 9ef776a
File tree
1 file changed
+12
-6
lines changed- sensorhub-service-consys/src/main/java/org/sensorhub/impl/service/consys
1 file changed
+12
-6
lines changedLines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | | - | |
| 395 | + | |
390 | 396 | | |
391 | 397 | | |
392 | 398 | | |
393 | | - | |
| 399 | + | |
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
| |||
416 | 422 | | |
417 | 423 | | |
418 | 424 | | |
419 | | - | |
| 425 | + | |
420 | 426 | | |
421 | 427 | | |
422 | 428 | | |
| |||
459 | 465 | | |
460 | 466 | | |
461 | 467 | | |
462 | | - | |
463 | | - | |
| 468 | + | |
| 469 | + | |
464 | 470 | | |
465 | 471 | | |
466 | 472 | | |
| |||
0 commit comments