Skip to content

Commit

Permalink
fixed error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
holashchand committed Jan 29, 2024
1 parent 43596c4 commit d9c3fd1
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ public ResponseEntity deleteAFile(@PathVariable String entity,
try {
fileStorageService.deleteDocument(objectName);
} catch (Exception e) {
String errorMsg = e.getMessage();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorMsg);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed deleting the document");
}
return ResponseEntity.ok(HttpStatus.OK);
}
Expand All @@ -132,7 +131,7 @@ public ResponseEntity<byte[]> get(@PathVariable String entity,
try {
document = fileStorageService.getDocument(objectName);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage().getBytes(StandardCharsets.UTF_8));
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed fetching the document".getBytes(StandardCharsets.UTF_8));
}
return ResponseEntity.ok().body(document);
}
Expand Down

0 comments on commit d9c3fd1

Please sign in to comment.