Skip to content

Commit

Permalink
refactor: Create BaseRuntimeException.java and updated files
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladik-gif committed Sep 8, 2024
1 parent ff10681 commit a11e4b9
Show file tree
Hide file tree
Showing 21 changed files with 79 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class ChangePasswordController {
private static final String PASSWORD_EMAIL = "/password/email";
private static final String PASSWORD_RESTORE = "/password/restore";

@Operation(summary = "Change to new password",
responses = {
@Operation(summary = "Change to new password", responses = {
@ApiResponse(responseCode = "200", description = SUCCESSFULLY_CHANGING_PASSWORD,
content = @Content),
@ApiResponse(responseCode = "400", description = INVALID_OLD_PASSWORD,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.chat.yourway.exception;

public class ContactAlreadySubscribedToTopicException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class ContactAlreadySubscribedToTopicException extends BaseRuntimeException {
public ContactAlreadySubscribedToTopicException(String message) {
super(message);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class ContactEmailNotExist extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class ContactEmailNotExist extends BaseRuntimeException {
public ContactEmailNotExist(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class ContactNotFoundException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class ContactNotFoundException extends BaseRuntimeException {
public ContactNotFoundException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class EmailSendingException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class EmailSendingException extends BaseRuntimeException {
public EmailSendingException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class EmailTokenNotFoundException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class EmailTokenNotFoundException extends BaseRuntimeException {
public EmailTokenNotFoundException() {
super("Current token does not exist");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class InvalidCredentialsException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class InvalidCredentialsException extends BaseRuntimeException {
public InvalidCredentialsException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class InvalidTokenException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class InvalidTokenException extends BaseRuntimeException {

public InvalidTokenException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class MessageHasAlreadyReportedException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class MessageHasAlreadyReportedException extends BaseRuntimeException {
public MessageHasAlreadyReportedException() {
super("Message has already reported.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class MessageNotFoundException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class MessageNotFoundException extends BaseRuntimeException {
public MessageNotFoundException() {
super("Message is not found.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class MessagePermissionDeniedException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class MessagePermissionDeniedException extends BaseRuntimeException {
public MessagePermissionDeniedException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class NotSubscribedTopicException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class NotSubscribedTopicException extends BaseRuntimeException {
public NotSubscribedTopicException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class OwnerCantUnsubscribedException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class OwnerCantUnsubscribedException extends BaseRuntimeException {

public OwnerCantUnsubscribedException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class PasswordsAreNotEqualException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class PasswordsAreNotEqualException extends BaseRuntimeException {
public PasswordsAreNotEqualException() {
super("Passwords are not equal.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class TokenNotFoundException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class TokenNotFoundException extends BaseRuntimeException {
public TokenNotFoundException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class TopicAccessException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class TopicAccessException extends BaseRuntimeException {
public TopicAccessException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class TopicNotFoundException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class TopicNotFoundException extends BaseRuntimeException {
public TopicNotFoundException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.chat.yourway.exception;

public class TopicSubscriberNotFoundException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class TopicSubscriberNotFoundException extends BaseRuntimeException {

public TopicSubscriberNotFoundException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.chat.yourway.exception;

public class ValueNotUniqException extends RuntimeException {
import com.chat.yourway.exception.handler.BaseRuntimeException;

public class ValueNotUniqException extends BaseRuntimeException {
public ValueNotUniqException(String message) {
super(message);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.chat.yourway.exception.handler;

public class BaseRuntimeException extends RuntimeException {
public BaseRuntimeException() {
super();
}

public BaseRuntimeException(Throwable cause) {
super(cause);
}

public BaseRuntimeException(String message) {
super(message);
}

public BaseRuntimeException(String message, Throwable cause) {
super(message, cause);
}

protected BaseRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public void handleWebSocketUnsubscribeListener(SessionUnsubscribeEvent event) {
String email = getEmail(event);

if (isTopicDestination(destination)) {
UUID topicId = getTopicId(event);
contactOnlineService.setUserOnline(email);
log.info("Contact [{}] unsubscribe from [{}]", email, destination);
}
Expand Down

0 comments on commit a11e4b9

Please sign in to comment.