• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

torresj / community-api / 28

16 Jun 2025 10:53AM UTC coverage: 74.063% (-8.8%) from 82.813%
28

push

circleci

Jaime Torres Benavente
fixing test errors

237 of 320 relevant lines covered (74.06%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.76
/src/main/java/com/torresj/community/exceptions/GlobalExceptionHandler.java
1
package com.torresj.community.exceptions;
2

3
import lombok.extern.slf4j.Slf4j;
4
import org.springframework.http.HttpStatus;
5
import org.springframework.http.ProblemDetail;
6
import org.springframework.web.bind.annotation.ControllerAdvice;
7
import org.springframework.web.bind.annotation.ExceptionHandler;
8
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
9

10
@ControllerAdvice
11
@Slf4j
1✔
12
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
1✔
13
    @ExceptionHandler(UserNotFoundException.class)
14
    ProblemDetail handleUserNotFound(UserNotFoundException e) {
15
        ProblemDetail problemDetail =
×
16
                ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, e.getMessage());
×
17
        problemDetail.setTitle(e.getMessage());
×
18
        log.error(e.toString());
×
19
        return problemDetail;
×
20
    }
21

22
    @ExceptionHandler(CommunityNotFoundException.class)
23
    ProblemDetail handleCommunityNotFoundException(CommunityNotFoundException e) {
24
        ProblemDetail problemDetail =
×
25
                ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, e.getMessage());
×
26
        problemDetail.setTitle(e.getMessage());
×
27
        log.error(e.toString());
×
28
        return problemDetail;
×
29
    }
30

31
    @ExceptionHandler(LoginException.class)
32
    ProblemDetail handleLoginException(LoginException e) {
33
        ProblemDetail problemDetail =
×
34
                ProblemDetail.forStatusAndDetail(HttpStatus.UNAUTHORIZED, e.getMessage());
×
35
        problemDetail.setTitle(e.getMessage());
×
36
        log.error(e.toString());
×
37
        return problemDetail;
×
38
    }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc