Skip to content

Commit f3a3dae

Browse files
committed
♻️ refactor:group, mypage 도메인 예외 처리 리팩터링
group과 mypage 도메인의 예외를 CustomExcetpion의 구현체로 변경
1 parent 5618a93 commit f3a3dae

29 files changed

+100
-519
lines changed
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class GroupAuthenticationException extends RuntimeException {
8+
public class GroupAuthenticationException extends CustomException {
89

9-
private final GroupErrorCode code;
1010

1111
public GroupAuthenticationException(GroupErrorCode code) {
12-
this.code = code;
12+
super(code);
1313
}
1414

1515
public GroupAuthenticationException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
16+
super(code, e);
1817
}
19-
20-
public GroupErrorCode code() {
21-
return code;
22-
}
23-
2418
}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class GroupNotFoundException extends RuntimeException {
8+
public class GroupNotFoundException extends CustomException {
89

9-
private final GroupErrorCode code;
1010

1111
public GroupNotFoundException(GroupErrorCode code) {
12-
this.code = code;
12+
super(code);
1313
}
1414

1515
public GroupNotFoundException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
16+
super(code,e);
1817
}
19-
20-
public GroupErrorCode code() {
21-
return code;
22-
}
23-
2418
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class NotGroupLeaderException extends RuntimeException {
8+
public class NotGroupLeaderException extends CustomException {
89

9-
private final GroupErrorCode code;
1010

1111
public NotGroupLeaderException(GroupErrorCode code) {
12-
this.code = code;
12+
super(code);
1313
}
1414

1515
public NotGroupLeaderException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
16+
super(code, e);
2217
}
2318
}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class NotGroupUserException extends RuntimeException {
8+
public class NotGroupUserException extends CustomException {
89

9-
private final GroupErrorCode code;
1010

1111
public NotGroupUserException(GroupErrorCode code) {
12-
this.code = code;
12+
super(code);
1313
}
1414

1515
public NotGroupUserException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
16+
super(code,e);
1817
}
1918

20-
public GroupErrorCode code() {
21-
return code;
22-
}
2319
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class NotScheduleLeaderException extends RuntimeException {
8+
public class NotScheduleLeaderException extends CustomException {
89

9-
private final GroupErrorCode code;
1010

1111
public NotScheduleLeaderException(GroupErrorCode code) {
12-
this.code = code;
12+
super(code);
1313
}
1414

1515
public NotScheduleLeaderException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
16+
super(code, e);
2217
}
2318
}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class NotScheduleUserException extends RuntimeException {
8-
9-
private final GroupErrorCode code;
8+
public class NotScheduleUserException extends CustomException {
109

1110
public NotScheduleUserException(GroupErrorCode code) {
12-
this.code = code;
11+
super(code);
1312
}
1413

1514
public NotScheduleUserException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
15+
super(code, e);
2216
}
2317
}
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class OnlyOneGroupLeaderException extends RuntimeException {
8-
9-
private final GroupErrorCode code;
8+
public class OnlyOneGroupLeaderException extends CustomException {
109

1110
public OnlyOneGroupLeaderException(GroupErrorCode code) {
12-
this.code = code;
11+
super(code);
1312
}
1413

1514
public OnlyOneGroupLeaderException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
15+
super(code, e);
2216
}
23-
2417
}
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class ScheduleAlreadyInGroupException extends RuntimeException {
8-
9-
private final GroupErrorCode code;
8+
public class ScheduleAlreadyInGroupException extends CustomException {
109

1110
public ScheduleAlreadyInGroupException(GroupErrorCode code) {
12-
this.code = code;
11+
super(code);
1312
}
1413

1514
public ScheduleAlreadyInGroupException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
15+
super(code, e);
2216
}
23-
2417
}
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class ScheduleNotFoundException extends RuntimeException {
8-
9-
private final GroupErrorCode code;
8+
public class ScheduleNotFoundException extends CustomException {
109

1110
public ScheduleNotFoundException(GroupErrorCode code) {
12-
this.code = code;
11+
super(code);
1312
}
1413

1514
public ScheduleNotFoundException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
15+
super(code, e);
2216
}
23-
2417
}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
package com.grepp.spring.infra.error.exceptions.group;
22

3+
import com.grepp.spring.infra.error.exceptions.CustomException;
34
import com.grepp.spring.infra.response.GroupErrorCode;
45
import lombok.extern.slf4j.Slf4j;
56

67
@Slf4j
7-
public class UserAlreadyInGroupException extends RuntimeException {
8-
9-
private final GroupErrorCode code;
8+
public class UserAlreadyInGroupException extends CustomException {
109

1110
public UserAlreadyInGroupException(GroupErrorCode code) {
12-
this.code = code;
11+
super(code);
1312
}
1413

1514
public UserAlreadyInGroupException(GroupErrorCode code, Exception e) {
16-
this.code = code;
17-
log.error(e.getMessage(), e);
18-
}
19-
20-
public GroupErrorCode code() {
21-
return code;
15+
super(code, e);
2216
}
2317

2418
}

0 commit comments

Comments
 (0)