From d6016d5cca6ebfb7ab435b6c41ca1deb9eb9c3b4 Mon Sep 17 00:00:00 2001 From: Lucy Ciara Herud-Thomassen <86323303+LucyCiara@users.noreply.github.com> Date: Tue, 21 Apr 2026 18:41:55 +0200 Subject: [PATCH] update[DbWrapper]: add exception throwing for exportUsers in case of SQLException --- src/main/java/edu/group5/app/model/wrapper/DbWrapper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java b/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java index fd2a2cc..3325b8c 100644 --- a/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java +++ b/src/main/java/edu/group5/app/model/wrapper/DbWrapper.java @@ -132,8 +132,10 @@ public List importUsers() { * @throws IllegalArgumentException This exception is thrown when data is null, its rows are not * of length 6, any of the rows are null, any of the rows are duplicates or existing rows in * the database, or any of the values in the rows can't be cast to the correct data-types. + * @throws SQLException Is thrown when an unexpected exception like trying to export a number + * that's too big happens. */ - public int exportUsers(List data) throws IllegalArgumentException { + public int exportUsers(List data) throws IllegalArgumentException, SQLException { this.importUsers(); ParameterValidator.exportChecker(data, "data", this.users, 6); @@ -163,6 +165,7 @@ public int exportUsers(List data) throws IllegalArgumentException { this.logger.info("Users exported"); } catch (SQLException e) { this.logger.log(Level.SEVERE, "Unexpected SQL exception", e); + throw new SQLException("An unexpected SQL exception has occurred. This might be caused by inserting an item that is too large."); } finally { this.close(null, ps); }