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

torresj / community-api / 50

08 Aug 2025 12:18PM UTC coverage: 82.171% (-6.6%) from 88.761%
50

push

circleci

Jaime Torres Benavente
owner controller with get endpoint added

8 of 25 new or added lines in 4 files covered. (32.0%)

318 of 387 relevant lines covered (82.17%)

0.82 hits per line

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

77.27
/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 =
1✔
16
                ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, e.getMessage());
1✔
17
        problemDetail.setTitle(e.getMessage());
1✔
18
        log.error(e.toString());
1✔
19
        return problemDetail;
1✔
20
    }
21

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

31
    @ExceptionHandler(LoginException.class)
32
    ProblemDetail handleLoginException(LoginException e) {
33
        ProblemDetail problemDetail =
1✔
34
                ProblemDetail.forStatusAndDetail(HttpStatus.UNAUTHORIZED, e.getMessage());
1✔
35
        problemDetail.setTitle(e.getMessage());
1✔
36
        log.error(e.toString());
1✔
37
        return problemDetail;
1✔
38
    }
39

40
    @ExceptionHandler(UserNotInCommunityException.class)
41
    ProblemDetail handleUserNotInCommunityException(UserNotInCommunityException e) {
NEW
42
        ProblemDetail problemDetail =
×
NEW
43
                ProblemDetail.forStatusAndDetail(HttpStatus.FORBIDDEN, e.getMessage());
×
NEW
44
        problemDetail.setTitle(e.getMessage());
×
NEW
45
        log.error(e.toString());
×
NEW
46
        return problemDetail;
×
47
    }
48
}
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