Skip to content

Commit 66b798b

Browse files
author
seskildsen
committed
fix: do not return sql statement in error message
1 parent b7c2a1f commit 66b798b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/dk/dataforsyningen/gsearch/errorhandling/ApiServiceAdvice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public ResponseEntity<ErrorResponse> handlePSQLException(
189189
PSQLException exception) {
190190
String exceptionCause = getRootCause(exception).toString();
191191
ErrorResponse errorResponse =
192-
new ErrorResponse(HttpStatus.BAD_REQUEST, exceptionCause);
192+
new ErrorResponse(HttpStatus.BAD_REQUEST, "PSQLException", "Database error");
193193
logger.info(ERROR_STRING, exception);
194194
logger.info(ERROR_STRING, exceptionCause);
195195
return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST);
@@ -199,7 +199,7 @@ public ResponseEntity<ErrorResponse> handlePSQLException(
199199
public ResponseEntity<ErrorResponse> handleUnableToExecuteStatementException(
200200
UnableToExecuteStatementException exception) {
201201
String exceptionCause = getRootCause(exception).toString();
202-
ErrorResponse errorResponse = new ErrorResponse(HttpStatus.BAD_REQUEST, exception.getMessage(), exceptionCause);
202+
ErrorResponse errorResponse = new ErrorResponse(HttpStatus.BAD_REQUEST, "UnableToExecuteStatementException", "Invalid input");
203203
logger.info(ERROR_STRING, exception);
204204
logger.info(ERROR_STRING + exceptionCause);
205205
return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST);

0 commit comments

Comments
 (0)