Skip to content

Commit

Permalink
refactor : toString Override
Browse files Browse the repository at this point in the history
  • Loading branch information
NameIsUser06 committed Jan 4, 2024
1 parent 5db67f1 commit 500a6da
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.investment.findfriend.global.error;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Getter;

Expand All @@ -8,4 +10,14 @@
public class ErrorResponse {
private int status;
private String message;

@Override
public String toString() {
ObjectMapper objectMapper = new ObjectMapper();
try {
return objectMapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
}

0 comments on commit 500a6da

Please sign in to comment.