Skip to content
Snippets Groups Projects
Commit 3d575316 authored by Daniel Vogel's avatar Daniel Vogel
Browse files

Added improved error message for too large images

parent a27f1541
Branches
Tags
No related merge requests found
......@@ -37,6 +37,7 @@ import de.thm.arsnova.exceptions.NotFoundException;
import de.thm.arsnova.exceptions.NotImplementedException;
import de.thm.arsnova.exceptions.PreconditionFailedException;
import de.thm.arsnova.exceptions.UnauthorizedException;
import de.thm.arsnova.exceptions.RequestEntityTooLargeException;
@ControllerAdvice
public class SecurityExceptionControllerAdvice {
......@@ -98,4 +99,9 @@ public class SecurityExceptionControllerAdvice {
@ExceptionHandler(NotImplementedException.class)
public void handleNotImplementedException(final Exception e, final HttpServletRequest request) {
}
@ResponseStatus(HttpStatus.REQUEST_ENTITY_TOO_LARGE)
@ExceptionHandler(RequestEntityTooLargeException.class)
public void handleRequestEntityTooLargeException(final Exception e, final HttpServletRequest request) {
}
}
......@@ -44,6 +44,7 @@ import de.thm.arsnova.entities.User;
import de.thm.arsnova.exceptions.ForbiddenException;
import de.thm.arsnova.exceptions.NotFoundException;
import de.thm.arsnova.exceptions.BadRequestException;
import de.thm.arsnova.exceptions.RequestEntityTooLargeException;
import de.thm.arsnova.socket.ARSnovaSocketIOServer;
@Service
......@@ -218,7 +219,7 @@ public class SessionService implements ISessionService {
final int fileSize = (int) ((session.getPpLogo().length()-814)/1.37);
if (fileSize > uploadFileSizeByte) {
LOGGER.error("Could not save file. File is too large with " + fileSize + " Byte.");
throw new BadRequestException();
throw new RequestEntityTooLargeException();
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment