Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 예외 처리 방식 개선 완료 #668

Merged
merged 23 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5fdf499
refactor: 낙관적 락, 암복호화, 이미지 압축 실패 예외 리팩토링
limehee Feb 13, 2025
5a4b436
refactor: 모집 도메인 예외 리팩토링
limehee Feb 13, 2025
9d21b2a
refactor: 활동 도메인 예외 리팩토링
limehee Feb 13, 2025
39ce3bc
refactor: 인증 도메인 예외 리팩토링
limehee Feb 13, 2025
cc36df7
refactor: 커뮤니티 도메인 예외 리팩토링
limehee Feb 13, 2025
30df37a
refactor: 도서 도메인 예외 리팩토링
limehee Feb 13, 2025
eb57691
refactor: 멤버 관리 도메인 예외 리팩토링
limehee Feb 13, 2025
a09e9f8
refactor: 인증/인가 예외 리팩토링
limehee Feb 13, 2025
9e69005
refactor: 웹훅 도메인 예외 리팩토링
limehee Feb 13, 2025
5d86e1f
refactor: InvalidColumnException 예외 리팩토링
limehee Feb 13, 2025
0d31f80
refactor: InvalidDateRangeException 예외 리팩토링
limehee Feb 13, 2025
907b078
refactor: Global 예외 리팩토링
limehee Feb 13, 2025
2b14f21
refactor: 기본 예외 리팩토링
limehee Feb 13, 2025
152c3e4
refactor: 파일 도메인 예외 리팩토링
limehee Feb 13, 2025
efe26e3
refactor: 기존과 동일하게 서버 에러 발생시 이벤트를 발행하도록 함
limehee Feb 13, 2025
9a27073
refactor: 미사용 에러 코드 제거
limehee Feb 13, 2025
0ff7591
refactor: 에러 코드 및 예외 알파벳 정렬
limehee Feb 13, 2025
6f78fb1
refactor: 잘못 분류된 에러 코드 수정
limehee Feb 13, 2025
c39ea4b
refactor: 예외 발생시 응답 형식 변경
limehee Feb 13, 2025
699099c
refactor: BaseException 외의 예외를 처리하는 핸들러 메소드명 변경
limehee Feb 17, 2025
1d384cb
refactor: 기존 예외 처리 방식과 동일하게 상태 코드를 전달하도록 변경
limehee Feb 17, 2025
6e49a42
refactor: 기존 예외 핸들러 제거
limehee Feb 17, 2025
f35705e
Merge branch 'develop' into refactor/#650
limehee Feb 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupResponseDto;
import page.clab.api.global.common.dto.ApiResponse;
import page.clab.api.global.common.dto.PagedResponseDto;
import page.clab.api.global.exception.InvalidColumnException;
import page.clab.api.global.exception.PermissionDeniedException;
import page.clab.api.global.exception.SortingArgumentException;
import page.clab.api.global.util.PageableUtils;

@RestController
Expand Down Expand Up @@ -59,7 +56,7 @@ public ApiResponse<Long> createActivityGroup(
public ApiResponse<Long> updateActivityGroup(
@PathVariable(name = "activityGroupId") Long activityGroupId,
@Valid @RequestBody ActivityGroupUpdateRequestDto requestDto
) throws PermissionDeniedException {
) {
Long id = activityGroupAdminService.updateActivityGroup(activityGroupId, requestDto);
return ApiResponse.success(id);
}
Expand All @@ -81,7 +78,7 @@ public ApiResponse<ActivityGroupBoardStatusUpdatedResponseDto> manageActivityGro
@DeleteMapping("/{activityGroupId}")
public ApiResponse<Long> deleteActivityGroup(
@PathVariable(name = "activityGroupId") Long activityGroupId
) throws PermissionDeniedException {
) {
Long id = activityGroupAdminService.deleteActivityGroup(activityGroupId);
return ApiResponse.success(id);
}
Expand All @@ -93,7 +90,7 @@ public ApiResponse<Long> deleteActivityGroup(
public ApiResponse<Long> updateProjectProgress(
@PathVariable(name = "activityGroupId") Long activityGroupId,
@RequestParam(name = "progress") Long progress
) throws PermissionDeniedException {
) {
Long id = activityGroupAdminService.updateProjectProgress(activityGroupId, progress);
return ApiResponse.success(id);
}
Expand All @@ -104,7 +101,7 @@ public ApiResponse<Long> updateProjectProgress(
public ApiResponse<Long> addSchedule(
@RequestParam(name = "activityGroupId") Long activityGroupId,
@Valid @RequestBody List<GroupScheduleDto> scheduleDtos
) throws PermissionDeniedException {
) {
Long id = activityGroupAdminService.addSchedule(activityGroupId, scheduleDtos);
return ApiResponse.success(id);
}
Expand All @@ -120,7 +117,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupMemberWithApplyReasonResponseDt
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "status") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "asc") List<String> sortDirection
) throws SortingArgumentException, PermissionDeniedException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupMemberWithApplyReasonResponseDto.class);
PagedResponseDto<ActivityGroupMemberWithApplyReasonResponseDto> groupMembers = activityGroupAdminService.getGroupMembersWithApplyReason(
Expand All @@ -135,7 +132,7 @@ public ApiResponse<Long> acceptGroupMember(
@RequestParam(name = "activityGroupId") Long activityGroupId,
@RequestParam(name = "memberId") List<String> memberIds,
@RequestParam(name = "status") GroupMemberStatus status
) throws PermissionDeniedException {
) {
Long id = activityGroupAdminService.manageGroupMemberStatus(activityGroupId, memberIds, status);
return ApiResponse.success(id);
}
Expand All @@ -150,7 +147,7 @@ public ApiResponse<Long> changeGroupMemberPosition(
@RequestParam(name = "activityGroupId") Long activityGroupId,
@RequestParam(name = "memberId") String memberId,
@RequestParam(name = "position") ActivityGroupRole position
) throws PermissionDeniedException {
) {
Long id = activityGroupAdminService.changeGroupMemberPosition(activityGroupId, memberId, position);
return ApiResponse.success(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
import page.clab.api.domain.activity.activitygroup.dto.response.AssignmentSubmissionWithFeedbackResponseDto;
import page.clab.api.global.common.dto.ApiResponse;
import page.clab.api.global.common.dto.PagedResponseDto;
import page.clab.api.global.exception.InvalidColumnException;
import page.clab.api.global.exception.PermissionDeniedException;
import page.clab.api.global.exception.SortingArgumentException;
import page.clab.api.global.util.PageableUtils;

@RestController
Expand All @@ -53,7 +50,7 @@ public ApiResponse<ActivityGroupBoardReferenceDto> createActivityGroupBoard(
@RequestParam(name = "parentId", required = false) Long parentId,
@RequestParam(name = "activityGroupId") Long activityGroupId,
@Valid @RequestBody ActivityGroupBoardRequestDto requestDto
) throws PermissionDeniedException {
) {
ActivityGroupBoardReferenceDto referenceDto = activityGroupBoardService.createActivityGroupBoard(parentId,
activityGroupId, requestDto);
return ApiResponse.success(referenceDto);
Expand All @@ -68,7 +65,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupBoardResponseDto>> getActivityG
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupBoardResponseDto.class);
PagedResponseDto<ActivityGroupBoardResponseDto> boards = activityGroupBoardService.getAllActivityGroupBoard(
Expand All @@ -81,7 +78,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupBoardResponseDto>> getActivityG
@GetMapping("")
public ApiResponse<ActivityGroupBoardResponseDto> getActivityGroupBoardById(
@RequestParam(name = "activityGroupBoardId") Long activityGroupBoardId
) throws PermissionDeniedException {
) {
ActivityGroupBoardResponseDto board = activityGroupBoardService.getActivityGroupBoard(activityGroupBoardId);
return ApiResponse.success(board);
}
Expand All @@ -97,7 +94,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupBoardResponseDto>> getActivityG
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, InvalidColumnException, PermissionDeniedException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupBoardResponseDto.class);
PagedResponseDto<ActivityGroupBoardResponseDto> boards = activityGroupBoardService.getActivityGroupBoardByCategory(
Expand All @@ -112,7 +109,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupBoardChildResponseDto>> getActi
@RequestParam(name = "parentId") Long parentId,
@RequestParam(name = "page", defaultValue = "0") int page,
@RequestParam(name = "size", defaultValue = "20") int size
) throws PermissionDeniedException {
) {
Pageable pageable = PageRequest.of(page, size);
PagedResponseDto<ActivityGroupBoardChildResponseDto> boards = activityGroupBoardService.getActivityGroupBoardByParent(
parentId, pageable);
Expand All @@ -136,7 +133,7 @@ public ApiResponse<List<AssignmentSubmissionWithFeedbackResponseDto>> getMyAssig
public ApiResponse<ActivityGroupBoardReferenceDto> updateActivityGroupBoard(
@RequestParam(name = "activityGroupBoardId") Long activityGroupBoardId,
@Valid @RequestBody ActivityGroupBoardUpdateRequestDto requestDto
) throws PermissionDeniedException {
) {
ActivityGroupBoardReferenceDto referenceDto = activityGroupBoardService.updateActivityGroupBoard(
activityGroupBoardId, requestDto);
return ApiResponse.success(referenceDto);
Expand All @@ -147,7 +144,7 @@ public ApiResponse<ActivityGroupBoardReferenceDto> updateActivityGroupBoard(
@DeleteMapping("")
public ApiResponse<ActivityGroupBoardReferenceDto> deleteActivityGroupBoard(
@RequestParam Long activityGroupBoardId
) throws PermissionDeniedException {
) {
ActivityGroupBoardReferenceDto referenceDto = activityGroupBoardService.deleteActivityGroupBoard(
activityGroupBoardId);
return ApiResponse.success(referenceDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import page.clab.api.domain.activity.activitygroup.dto.response.GroupMemberResponseDto;
import page.clab.api.global.common.dto.ApiResponse;
import page.clab.api.global.common.dto.PagedResponseDto;
import page.clab.api.global.exception.InvalidColumnException;
import page.clab.api.global.exception.SortingArgumentException;
import page.clab.api.global.util.PageableUtils;

@RestController
Expand Down Expand Up @@ -58,7 +56,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupStatusResponseDto>> getMyActivi
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws InvalidColumnException, SortingArgumentException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupStatusResponseDto.class);
PagedResponseDto<ActivityGroupStatusResponseDto> activityGroups = activityGroupMemberService.getMyActivityGroups(
Expand All @@ -76,7 +74,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupStatusResponseDto>> getActivity
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws InvalidColumnException, SortingArgumentException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupStatusResponseDto.class);
PagedResponseDto<ActivityGroupStatusResponseDto> activityGroups = activityGroupMemberService.getActivityGroupsByStatus(
Expand All @@ -94,7 +92,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupResponseDto>> getActivityGroups
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupResponseDto.class);
PagedResponseDto<ActivityGroupResponseDto> activityGroups = activityGroupMemberService.getActivityGroupsByCategory(
Expand All @@ -112,7 +110,7 @@ public ApiResponse<PagedResponseDto<GroupScheduleDto>> getGroupScheduleList(
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "schedule") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection, GroupScheduleDto.class);
PagedResponseDto<GroupScheduleDto> groupSchedules = activityGroupMemberService.getGroupSchedules(
activityGroupId, pageable);
Expand All @@ -130,7 +128,7 @@ public ApiResponse<PagedResponseDto<GroupMemberResponseDto>> getActivityGroupMem
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "memberId") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "asc") List<String> sortDirection
) throws SortingArgumentException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
GroupMemberResponseDto.class);
PagedResponseDto<GroupMemberResponseDto> activityGroupMembers = activityGroupMemberService.getActivityGroupMembers(
Expand Down Expand Up @@ -158,7 +156,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupStatusResponseDto>> getAppliedA
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws InvalidColumnException, SortingArgumentException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupStatusResponseDto.class);
PagedResponseDto<ActivityGroupStatusResponseDto> activityGroups = activityGroupMemberService.getAppliedActivityGroups(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
import page.clab.api.domain.activity.activitygroup.dto.response.ActivityGroupReportResponseDto;
import page.clab.api.global.common.dto.ApiResponse;
import page.clab.api.global.common.dto.PagedResponseDto;
import page.clab.api.global.exception.InvalidColumnException;
import page.clab.api.global.exception.PermissionDeniedException;
import page.clab.api.global.exception.SortingArgumentException;
import page.clab.api.global.util.PageableUtils;

@RestController
Expand All @@ -42,7 +39,7 @@ public class ActivityGroupReportController {
@PostMapping("")
public ApiResponse<Long> writeReport(
@Valid @RequestBody ActivityGroupReportRequestDto requestDto
) throws PermissionDeniedException, IllegalAccessException {
) throws IllegalAccessException {
Long id = activityGroupReportService.writeReport(requestDto);
return ApiResponse.success(id);
}
Expand All @@ -57,7 +54,7 @@ public ApiResponse<PagedResponseDto<ActivityGroupReportResponseDto>> getReports(
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "createdAt") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
ActivityGroupReportResponseDto.class);
PagedResponseDto<ActivityGroupReportResponseDto> reports = activityGroupReportService.getReports(
Expand All @@ -83,7 +80,7 @@ public ApiResponse<Long> updateReport(
@PathVariable(name = "reportId") Long reportId,
@RequestParam(name = "activityGroupId") Long activityGroupId,
@Valid @RequestBody ActivityGroupReportUpdateRequestDto requestDto
) throws PermissionDeniedException, IllegalAccessException {
) throws IllegalAccessException {
Long id = activityGroupReportService.updateReport(reportId, activityGroupId, requestDto);
return ApiResponse.success(id);
}
Expand All @@ -93,7 +90,7 @@ public ApiResponse<Long> updateReport(
@DeleteMapping("/{reportId}")
public ApiResponse<Long> deleteAward(
@PathVariable(name = "reportId") Long reportId
) throws PermissionDeniedException {
) {
Long id = activityGroupReportService.deleteReport(reportId);
return ApiResponse.success(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
import page.clab.api.domain.activity.activitygroup.dto.request.AttendanceRequestDto;
import page.clab.api.domain.activity.activitygroup.dto.response.AbsentResponseDto;
import page.clab.api.domain.activity.activitygroup.dto.response.AttendanceResponseDto;
import page.clab.api.domain.activity.activitygroup.exception.DuplicateAbsentExcuseException;
import page.clab.api.global.common.dto.ApiResponse;
import page.clab.api.global.common.dto.PagedResponseDto;
import page.clab.api.global.exception.InvalidColumnException;
import page.clab.api.global.exception.PermissionDeniedException;
import page.clab.api.global.exception.SortingArgumentException;
import page.clab.api.global.util.PageableUtils;

@RestController
Expand All @@ -42,7 +38,7 @@ public class AttendanceController {
@PostMapping(value = "")
public ApiResponse<String> generateAttendanceQRCode(
@RequestParam(name = "activityGroupId") Long activityGroupId
) throws IOException, WriterException, PermissionDeniedException, IllegalAccessException {
) throws IOException, WriterException, IllegalAccessException {
String QRCodeURL = attendanceService.generateAttendanceQRCode(activityGroupId);
return ApiResponse.success(QRCodeURL);
}
Expand All @@ -67,7 +63,7 @@ public ApiResponse<PagedResponseDto<AttendanceResponseDto>> searchMyAttendance(
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "attendanceDateTime") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, IllegalAccessException, InvalidColumnException {
) throws IllegalAccessException {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
AttendanceResponseDto.class);
PagedResponseDto<AttendanceResponseDto> myAttendances = attendanceService.getMyAttendances(activityGroupId,
Expand All @@ -85,7 +81,7 @@ public ApiResponse<PagedResponseDto<AttendanceResponseDto>> searchGroupAttendanc
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "memberId") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "asc") List<String> sortDirection
) throws SortingArgumentException, PermissionDeniedException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection,
AttendanceResponseDto.class);
PagedResponseDto<AttendanceResponseDto> attendances = attendanceService.getGroupAttendances(activityGroupId,
Expand All @@ -98,7 +94,7 @@ public ApiResponse<PagedResponseDto<AttendanceResponseDto>> searchGroupAttendanc
@PostMapping({"/absent"})
public ApiResponse<Long> writeAbsentExcuse(
@RequestBody AbsentRequestDto requestDto
) throws IllegalAccessException, DuplicateAbsentExcuseException {
) throws IllegalAccessException {
Long id = attendanceService.writeAbsentExcuse(requestDto);
return ApiResponse.success(id);
}
Expand All @@ -113,7 +109,7 @@ public ApiResponse<PagedResponseDto<AbsentResponseDto>> getActivityGroupAbsentEx
@RequestParam(name = "size", defaultValue = "20") int size,
@RequestParam(name = "sortBy", defaultValue = "absentDate") List<String> sortBy,
@RequestParam(name = "sortDirection", defaultValue = "desc") List<String> sortDirection
) throws SortingArgumentException, PermissionDeniedException, InvalidColumnException {
) {
Pageable pageable = pageableUtils.createPageable(page, size, sortBy, sortDirection, AbsentResponseDto.class);
PagedResponseDto<AbsentResponseDto> absentExcuses = attendanceService.getActivityGroupAbsentExcuses(
activityGroupId, pageable);
Expand Down
Loading
Loading