Skip to content

Commit

Permalink
chore: fix backend integration tests & issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Jan 29, 2025
1 parent d833b01 commit bfb129f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
14 changes: 5 additions & 9 deletions backend/app/src/main/kotlin/io/tolgee/ExceptionHandlers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.tolgee.constants.Message
import io.tolgee.dtos.request.validators.ValidationErrorType
import io.tolgee.dtos.request.validators.exceptions.ValidationException
import io.tolgee.exceptions.BadRequestException
import io.tolgee.exceptions.ErrorException
import io.tolgee.exceptions.ErrorResponseBody
import io.tolgee.exceptions.ErrorResponseTyped
import io.tolgee.exceptions.NotFoundException
import io.tolgee.exceptions.*
import io.tolgee.security.ratelimit.RateLimitResponseBody
import io.tolgee.security.ratelimit.RateLimitedException
import io.tolgee.util.Logging
import io.tolgee.util.logger
import jakarta.persistence.EntityNotFoundException
import jakarta.servlet.http.HttpServletRequest
import org.apache.catalina.connector.ClientAbortException
import org.apache.commons.lang3.exception.ExceptionUtils
import org.hibernate.QueryException
import org.slf4j.LoggerFactory
import org.springframework.dao.InvalidDataAccessApiUsageException
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
Expand All @@ -42,9 +39,7 @@ import java.util.*
import java.util.function.Consumer

@RestControllerAdvice
class ExceptionHandlers {
private val logger = LoggerFactory.getLogger(this::class.java)

class ExceptionHandlers: Logging {
@ExceptionHandler(MethodArgumentNotValidException::class)
fun handleValidationExceptions(
ex: MethodArgumentNotValidException,
Expand Down Expand Up @@ -164,6 +159,7 @@ class ExceptionHandlers {
)
@ExceptionHandler(ErrorException::class)
fun handleServerError(ex: ErrorException): ResponseEntity<ErrorResponseBody> {
logger.debug("Exception with response status {} caught", ex.httpStatus, ex)
return ResponseEntity(ex.errorResponseBody, ex.httpStatus)
}

Expand Down
9 changes: 3 additions & 6 deletions ee/backend/tests/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ springdoc:
api-docs:
enabled: false

#logging:
# level:
# org.springframework.orm.jpa: DEBUG
# org.springframework.transaction: DEBUG
# org.hibernate.type: TRACE

logging:
level:
"io.tolgee.ExceptionHandlers": DEBUG

0 comments on commit bfb129f

Please sign in to comment.