Skip to content

Commit

Permalink
Bruk default håndtering som spring tilbyr
Browse files Browse the repository at this point in the history
Signed-off-by: Henrik uran <[email protected]>
  • Loading branch information
henriktheboss committed Dec 20, 2024
1 parent aca0cf7 commit f7ed991
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ class HttpExceptionHandler : ResponseEntityExceptionHandler() {
.body(Response(statusCode = e.statusCode.value(), message = e.reason))
}

@ExceptionHandler(value = [RuntimeException::class])
fun handleRuntimeException(e: RuntimeException, request: WebRequest): ResponseEntity<Response> {
val statusKode = HttpStatus.INTERNAL_SERVER_ERROR.value()
log.error("Feil i håndtering av kall", e)
return ResponseEntity
.status(statusKode)
.body(Response(statusCode = statusKode, message = "Noe gikk galt"))
}

@JsonInclude(JsonInclude.Include.NON_NULL)
data class Response(
val message: String?,
Expand Down

0 comments on commit f7ed991

Please sign in to comment.