From 7027241c11c7593431c7386299d677c85d25c20e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emir=20Enes=20Akal=C4=B1n?= Date: Sun, 5 Oct 2025 14:06:30 +0300 Subject: [PATCH] Enhances UserNotAuthenticatedException Improves the `UserNotAuthenticatedException` by adding constructors to handle more specific error messages and include a cause. This provides better context and debugging information when a user is not properly authenticated. --- .../error/UserNotAuthenticatedException.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/mentora/backend/error/UserNotAuthenticatedException.java b/backend/src/main/java/com/mentora/backend/error/UserNotAuthenticatedException.java index 626bc50..53fc076 100644 --- a/backend/src/main/java/com/mentora/backend/error/UserNotAuthenticatedException.java +++ b/backend/src/main/java/com/mentora/backend/error/UserNotAuthenticatedException.java @@ -1,7 +1,19 @@ package com.mentora.backend.error; +/** + * Exception thrown when a user is not authenticated. + */ public class UserNotAuthenticatedException extends RuntimeException { + public UserNotAuthenticatedException() { - super("User is not authenticated"); + super("User not authenticated"); + } + + public UserNotAuthenticatedException(String message) { + super(message); + } + + public UserNotAuthenticatedException(String message, Throwable cause) { + super(message, cause); } -} +} \ No newline at end of file