Skip to content

Commit ee0aed0

Browse files
committed
fix(webauthn): remove noisy stack traces from expected exception logging
Drop the exception object from log.warn() calls in WebAuthnManagementAPIAdvice. These are expected business and validation errors (credential not found, validation failures), not unexpected system failures, so full stack traces add noise without diagnostic value.
1 parent 8976513 commit ee0aed0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/com/digitalsanctuary/spring/user/api/WebAuthnManagementAPIAdvice.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ public class WebAuthnManagementAPIAdvice {
2020

2121
@ExceptionHandler(WebAuthnUserNotFoundException.class)
2222
public ResponseEntity<GenericResponse> handleUserNotFound(WebAuthnUserNotFoundException ex) {
23-
log.warn("WebAuthn user not found: {}", ex.getMessage(), ex);
23+
log.warn("WebAuthn user not found: {}", ex.getMessage());
2424
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new GenericResponse(ex.getMessage()));
2525
}
2626

2727
@ExceptionHandler(WebAuthnException.class)
2828
public ResponseEntity<GenericResponse> handleWebAuthnError(WebAuthnException ex) {
29-
log.warn("WebAuthn error: {}", ex.getMessage(), ex);
29+
log.warn("WebAuthn error: {}", ex.getMessage());
3030
return ResponseEntity.badRequest().body(new GenericResponse(ex.getMessage()));
3131
}
3232

3333
@ExceptionHandler(MethodArgumentNotValidException.class)
3434
public ResponseEntity<GenericResponse> handleValidation(MethodArgumentNotValidException ex) {
35-
log.warn("WebAuthn validation error: {}", ex.getMessage(), ex);
35+
log.warn("WebAuthn validation error: {}", ex.getMessage());
3636
return ResponseEntity.badRequest().body(new GenericResponse(ex.getBindingResult().getAllErrors(), "Validation failed"));
3737
}
3838

3939
@ExceptionHandler(ConstraintViolationException.class)
4040
public ResponseEntity<GenericResponse> handleConstraintViolation(ConstraintViolationException ex) {
41-
log.warn("WebAuthn constraint violation: {}", ex.getMessage(), ex);
41+
log.warn("WebAuthn constraint violation: {}", ex.getMessage());
4242
return ResponseEntity.badRequest().body(new GenericResponse("Validation failed"));
4343
}
4444
}

0 commit comments

Comments
 (0)