Skip to content

Commit

Permalink
Discord 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhello0507 committed Jan 6, 2025
1 parent 652584d commit 7fed387
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
22 changes: 0 additions & 22 deletions src/main/kotlin/com/ohayo/moyamoya/api/TestController.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class CustomExceptionHandler(
@ExceptionHandler(Exception::class)
fun handleException(exception: Exception, webRequest: WebRequest): ResponseEntity<ErrorRes> {
logger.error("CustomExceptionHandler.Exception", exception)

if (environment.activeProfiles.contains("prd")) {
discordErrorSendService.sendDiscordAlarm(exception, webRequest)
}

return createErrorResponse(
status = HttpStatus.INTERNAL_SERVER_ERROR,
message = HttpStatus.INTERNAL_SERVER_ERROR.reasonPhrase,
Expand All @@ -67,7 +67,7 @@ class CustomExceptionHandler(
status: HttpStatus,
message: String,
) = ResponseEntity.status(status).body(

ErrorRes(
status = status.value(),
message = message
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/ohayo/moyamoya/infra/Discord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.ohayo.moyamoya.infra
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Service
import org.springframework.web.client.RestClient
import org.springframework.web.client.body
import org.springframework.web.context.request.ServletWebRequest
import org.springframework.web.context.request.WebRequest
import java.io.PrintWriter
Expand All @@ -29,6 +30,7 @@ class DiscordErrorSendService(
restClient.post()
.body(createMessage(e, request))
.retrieve()
.body<Any>()
}

private fun createMessage(e: Exception, request: WebRequest): DiscordMessage {
Expand Down

0 comments on commit 7fed387

Please sign in to comment.