mirror of
https://github.com/dalbodeule/sh0rt.kr-pdns.git
synced 2025-06-08 18:58:20 +00:00
fix pdns api clients (retry 22x)
add Throwable handler
This commit is contained in:
parent
7b408eb946
commit
25a7b6ca85
@ -12,7 +12,7 @@ class GlobalExceptionHandler {
|
||||
@ExceptionHandler(PowerDNSAPIException::class)
|
||||
fun handlePowerDNSAPIException(ex: PowerDNSAPIException): ResponseEntity<ApiResponseDTO<Nothing>> {
|
||||
var idx = 0
|
||||
val errors = mutableListOf(ErrorOrMessage(idx, ex.message ?: ""))
|
||||
val errors = mutableListOf(ErrorOrMessage(idx, ex.message ?: "PowerDNSAPIException"))
|
||||
ex.errors?.forEach{
|
||||
errors.add(ErrorOrMessage(idx++, it))
|
||||
}
|
||||
@ -25,4 +25,17 @@ class GlobalExceptionHandler {
|
||||
|
||||
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(response)
|
||||
}
|
||||
|
||||
@ExceptionHandler(Throwable::class)
|
||||
fun handleException(ex: Throwable): ResponseEntity<ApiResponseDTO<Nothing>> {
|
||||
val errors = mutableListOf(ErrorOrMessage(0, ex.message ?: "Error"))
|
||||
|
||||
val response = ApiResponseDTO(
|
||||
success = false,
|
||||
errors = errors,
|
||||
result = null
|
||||
)
|
||||
|
||||
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body(response)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user