Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
errorMap 추가
Browse files Browse the repository at this point in the history
VersionMismatchException 이 아닌 다른 예외는 ExecuteFailedException으로 맵핑하여 처리
  • Loading branch information
ori0o0p committed Feb 27, 2024
1 parent 6390a65 commit 77f1ed2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.example.daemawiki.domain.revision.dto.request.SaveRevisionHistoryRequest;
import com.example.daemawiki.domain.revision.model.type.RevisionType;
import com.example.daemawiki.global.exception.h400.VersionMismatchException;
import com.example.daemawiki.global.exception.h500.ExecuteFailedException;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

Expand Down Expand Up @@ -64,7 +65,8 @@ public Mono<Void> execute(AddContentRequest request) {
.type(RevisionType.UPDATE)
.documentId(request.documentId())
.title(document.getTitle())
.build()));
.build()))
.onErrorMap(e -> e instanceof VersionMismatchException ? e : ExecuteFailedException.EXCEPTION);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.example.daemawiki.domain.revision.dto.request.SaveRevisionHistoryRequest;
import com.example.daemawiki.domain.revision.model.type.RevisionType;
import com.example.daemawiki.global.exception.h400.VersionMismatchException;
import com.example.daemawiki.global.exception.h500.ExecuteFailedException;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

Expand Down Expand Up @@ -36,7 +37,8 @@ public Mono<Void> execute(UpdateInfoRequest request) {
.type(RevisionType.UPDATE)
.documentId(request.documentId())
.title(document.getTitle())
.build()));
.build()))
.onErrorMap(e -> e instanceof VersionMismatchException ? e : ExecuteFailedException.EXCEPTION);
}

}

0 comments on commit 77f1ed2

Please sign in to comment.