Skip to content

Commit

Permalink
Merge pull request #58 from Leets-Official/refactor/#52/GlobalExcepti…
Browse files Browse the repository at this point in the history
…onHandler-로직수정

Refactor #58 글로벌 예외 핸들러 수정 및 예외 관리 수정
  • Loading branch information
huncozyboy authored Oct 24, 2024
2 parents 11d3efd + a65503a commit 59e3f28
Show file tree
Hide file tree
Showing 65 changed files with 211 additions and 220 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.account.application.exception;


import jakarta.persistence.EntityExistsException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.account.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.account.application.exception;


import jakarta.persistence.EntityExistsException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import leets.weeth.domain.account.domain.entity.Account;
import leets.weeth.domain.account.domain.service.AccountGetService;
import leets.weeth.domain.account.domain.service.AccountSaveService;
import leets.weeth.global.common.error.exception.custom.AccountExistsException;
import leets.weeth.domain.account.application.exception.AccountExistsException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import leets.weeth.domain.account.domain.entity.Account;
import leets.weeth.domain.account.domain.repository.AccountRepository;
import leets.weeth.global.common.error.exception.custom.AccountNotFoundException;
import leets.weeth.domain.account.application.exception.AccountNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import leets.weeth.domain.account.domain.entity.Receipt;
import leets.weeth.domain.account.domain.repository.ReceiptRepository;
import leets.weeth.global.common.error.exception.custom.ReceiptNotFoundException;
import leets.weeth.domain.account.application.exception.ReceiptNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package leets.weeth.domain.attendance.application.exception;

import leets.weeth.global.common.exception.BusinessLogicException;

public class AttendanceCodeMismatchException extends BusinessLogicException {
public AttendanceCodeMismatchException() {super(400 ,"출석 코드가 일치하지 않습니다.");}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package leets.weeth.domain.attendance.application.exception;

import leets.weeth.global.common.exception.BusinessLogicException;

public class AttendanceEventTypeNotMatchException extends BusinessLogicException {
public AttendanceEventTypeNotMatchException() {super(400, "출석일정은 직접 수정할 수 없습니다.");}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.attendance.application.exception;
import jakarta.persistence.EntityNotFoundException;

public class AttendanceNotFoundException extends EntityNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package leets.weeth.domain.attendance.application.usecase;

import leets.weeth.global.common.error.exception.custom.AttendanceCodeMismatchException;
import leets.weeth.domain.attendance.application.exception.AttendanceCodeMismatchException;

import java.time.LocalDate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import leets.weeth.domain.schedule.domain.service.MeetingGetService;
import leets.weeth.domain.user.domain.entity.User;
import leets.weeth.domain.user.domain.service.UserGetService;
import leets.weeth.global.common.error.exception.custom.AttendanceCodeMismatchException;
import leets.weeth.global.common.error.exception.custom.AttendanceNotFoundException;
import leets.weeth.global.common.error.exception.custom.MeetingNotFoundException;
import leets.weeth.domain.attendance.application.exception.AttendanceCodeMismatchException;
import leets.weeth.domain.attendance.application.exception.AttendanceNotFoundException;
import leets.weeth.domain.schedule.application.exception.MeetingNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import leets.weeth.domain.attendance.application.dto.AttendanceDTO;
import leets.weeth.domain.attendance.application.usecase.AttendanceUseCase;
import leets.weeth.global.auth.annotation.CurrentUser;
import leets.weeth.global.common.error.exception.custom.AttendanceCodeMismatchException;
import leets.weeth.domain.attendance.application.exception.AttendanceCodeMismatchException;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.board.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package leets.weeth.domain.board.application.exception;

import leets.weeth.global.common.exception.BusinessLogicException;

public class NoticeTypeNotMatchException extends BusinessLogicException {
public NoticeTypeNotMatchException() {super(400, "공지사항은 공지사항 게시판에서 수정하세요.");}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.board.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package leets.weeth.domain.board.application.usecase;

import leets.weeth.domain.board.application.dto.NoticeDTO;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import org.springframework.web.bind.annotation.RequestParam;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import leets.weeth.domain.file.service.FileSaveService;
import leets.weeth.domain.user.domain.entity.User;
import leets.weeth.domain.user.domain.service.UserGetService;
import leets.weeth.global.common.error.exception.custom.NoticeNotFoundException;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.board.application.exception.NoticeNotFoundException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import leets.weeth.domain.file.service.FileSaveService;
import leets.weeth.domain.user.domain.entity.User;
import leets.weeth.domain.user.domain.service.UserGetService;
import leets.weeth.global.common.error.exception.custom.PostNotFoundException;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.board.application.exception.PostNotFoundException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package leets.weeth.domain.board.application.usecase;

import leets.weeth.domain.board.application.dto.PostDTO;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import org.springframework.web.bind.annotation.RequestParam;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import leets.weeth.domain.board.domain.entity.Notice;
import leets.weeth.domain.board.domain.repository.NoticeRepository;
import leets.weeth.global.common.error.exception.custom.NoticeNotFoundException;
import leets.weeth.domain.board.application.exception.NoticeNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package leets.weeth.domain.board.domain.service;

import leets.weeth.domain.board.domain.entity.Notice;
import leets.weeth.domain.board.domain.entity.Post;
import leets.weeth.domain.board.domain.repository.PostRepository;
import leets.weeth.global.common.error.exception.custom.PostNotFoundException;
import leets.weeth.domain.board.application.exception.PostNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import jakarta.validation.Valid;
import leets.weeth.domain.board.application.dto.NoticeDTO;
import leets.weeth.domain.board.application.usecase.NoticeUsecase;
import leets.weeth.domain.board.domain.entity.enums.ResponseMessage;
import leets.weeth.global.auth.annotation.CurrentUser;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import leets.weeth.domain.board.application.dto.PostDTO;
import leets.weeth.domain.board.application.usecase.PostUsecase;
import leets.weeth.global.auth.annotation.CurrentUser;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.comment.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package leets.weeth.domain.comment.application.usecase;

import leets.weeth.domain.comment.application.dto.CommentDTO;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;

public interface NoticeCommentUsecase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
import leets.weeth.domain.comment.domain.service.CommentSaveService;
import leets.weeth.domain.user.domain.entity.User;
import leets.weeth.domain.user.domain.service.UserGetService;
import leets.weeth.global.common.error.exception.custom.CommentNotFoundException;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.comment.application.exception.CommentNotFoundException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package leets.weeth.domain.comment.application.usecase;

import leets.weeth.domain.comment.application.dto.CommentDTO;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;

public interface PostCommentUsecase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import leets.weeth.domain.comment.domain.service.CommentSaveService;
import leets.weeth.domain.user.domain.entity.User;
import leets.weeth.domain.user.domain.service.UserGetService;
import leets.weeth.global.common.error.exception.custom.CommentNotFoundException;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.comment.application.exception.CommentNotFoundException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import leets.weeth.domain.comment.domain.entity.Comment;
import leets.weeth.domain.comment.domain.repository.CommentRepository;
import leets.weeth.global.common.error.exception.custom.CommentNotFoundException;
import leets.weeth.domain.comment.application.exception.CommentNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import jakarta.validation.Valid;
import leets.weeth.domain.comment.application.dto.CommentDTO;
import leets.weeth.domain.comment.application.usecase.NoticeCommentUsecase;
import leets.weeth.domain.comment.application.usecase.PostCommentUsecase;
import leets.weeth.domain.comment.domain.entity.enums.ResponseMessage;
import leets.weeth.global.auth.annotation.CurrentUser;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import jakarta.validation.Valid;
import leets.weeth.domain.comment.application.dto.CommentDTO;
import leets.weeth.domain.comment.application.usecase.PostCommentUsecase;
import leets.weeth.domain.comment.domain.entity.enums.ResponseMessage;
import leets.weeth.global.auth.annotation.CurrentUser;
import leets.weeth.global.common.error.exception.custom.UserNotMatchException;
import leets.weeth.domain.user.application.exception.UserNotMatchException;
import leets.weeth.global.common.response.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.penalty.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import leets.weeth.domain.penalty.domain.entity.Penalty;
import leets.weeth.domain.penalty.domain.repository.PenaltyRepository;
import leets.weeth.global.common.error.exception.custom.PenaltyNotFoundException;
import leets.weeth.domain.penalty.application.exception.PenaltyNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.schedule.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.schedule.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import leets.weeth.domain.schedule.application.mapper.ScheduleMapper;
import leets.weeth.domain.schedule.domain.entity.Event;
import leets.weeth.domain.schedule.domain.repository.EventRepository;
import leets.weeth.global.common.error.exception.custom.EventNotFoundException;
import leets.weeth.domain.schedule.application.exception.EventNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import leets.weeth.domain.schedule.application.mapper.ScheduleMapper;
import leets.weeth.domain.schedule.domain.entity.Meeting;
import leets.weeth.domain.schedule.domain.repository.MeetingRepository;
import leets.weeth.global.common.error.exception.custom.MeetingNotFoundException;
import leets.weeth.domain.schedule.application.exception.MeetingNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.user.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.user.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.user.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.user.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.user.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package leets.weeth.domain.user.application.exception;

import leets.weeth.global.common.exception.BusinessLogicException;

public class UserMismatchException extends BusinessLogicException {
public UserMismatchException() {
super(400, "사용자가 현재 사용자와 일치하지 않습니다.");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package leets.weeth.global.common.error.exception.custom;
package leets.weeth.domain.user.application.exception;

import jakarta.persistence.EntityNotFoundException;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package leets.weeth.domain.user.application.exception;

import leets.weeth.global.common.exception.BusinessLogicException;

public class UserNotMatchException extends BusinessLogicException {
public UserNotMatchException() {super(400, "생성한 사용자와 일치하지 않습니다.");}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import leets.weeth.domain.user.domain.service.UserGetService;
import leets.weeth.domain.user.domain.service.UserSaveService;
import leets.weeth.domain.user.domain.service.UserUpdateService;
import leets.weeth.global.common.error.exception.custom.StudentIdExistsException;
import leets.weeth.global.common.error.exception.custom.TelExistsException;
import leets.weeth.domain.user.application.exception.StudentIdExistsException;
import leets.weeth.domain.user.application.exception.TelExistsException;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import leets.weeth.domain.user.domain.entity.enums.Role;
import leets.weeth.domain.user.domain.entity.enums.Status;
import leets.weeth.global.common.entity.BaseEntity;
import leets.weeth.global.common.error.exception.custom.CardinalNotFoundException;
import leets.weeth.domain.user.application.exception.CardinalNotFoundException;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Loading

0 comments on commit 59e3f28

Please sign in to comment.