Browse Source

err base handler

master
gsd 11 months ago
parent
commit
aa352c254c
  1. 4
      src/main/java/app/annotations/exceptions/FailedAuthCheck.java
  2. 4
      src/main/java/app/annotations/exceptions/InvalidCookie.java
  3. 4
      src/main/java/app/annotations/exceptions/InvalidSecretKey.java
  4. 4
      src/main/java/app/annotations/exceptions/LowPermition.java
  5. 4
      src/main/java/app/annotations/exceptions/NeedCookie.java
  6. 4
      src/main/java/app/annotations/exceptions/WaitRateLimit.java
  7. 4
      src/main/java/app/exceptions/BaseWebException.java
  8. 5
      src/main/java/app/exceptions/RestResponseStatusExceptionResolver.java
  9. 7
      src/main/java/app/services/ProfileService.java

4
src/main/java/app/annotations/exceptions/FailedAuthCheck.java

@ -1,4 +1,6 @@
package app.annotations.exceptions;
public class FailedAuthCheck extends RuntimeException{
import app.exceptions.BaseWebException;
public class FailedAuthCheck extends BaseWebException {
}

4
src/main/java/app/annotations/exceptions/InvalidCookie.java

@ -1,4 +1,6 @@
package app.annotations.exceptions;
public class InvalidCookie extends RuntimeException{
import app.exceptions.BaseWebException;
public class InvalidCookie extends BaseWebException {
}

4
src/main/java/app/annotations/exceptions/InvalidSecretKey.java

@ -1,4 +1,6 @@
package app.annotations.exceptions;
public class InvalidSecretKey extends RuntimeException{
import app.exceptions.BaseWebException;
public class InvalidSecretKey extends BaseWebException {
}

4
src/main/java/app/annotations/exceptions/LowPermition.java

@ -1,4 +1,6 @@
package app.annotations.exceptions;
public class LowPermition extends RuntimeException{
import app.exceptions.BaseWebException;
public class LowPermition extends BaseWebException {
}

4
src/main/java/app/annotations/exceptions/NeedCookie.java

@ -1,4 +1,6 @@
package app.annotations.exceptions;
public class NeedCookie extends RuntimeException{
import app.exceptions.BaseWebException;
public class NeedCookie extends BaseWebException {
}

4
src/main/java/app/annotations/exceptions/WaitRateLimit.java

@ -1,4 +1,6 @@
package app.annotations.exceptions;
public class WaitRateLimit extends RuntimeException {
import app.exceptions.BaseWebException;
public class WaitRateLimit extends BaseWebException {
}

4
src/main/java/app/exceptions/BaseWebException.java

@ -0,0 +1,4 @@
package app.exceptions;
public abstract class BaseWebException extends RuntimeException {
}

5
src/main/java/app/exceptions/RestResponseStatusExceptionResolver.java

@ -17,6 +17,11 @@ public class RestResponseStatusExceptionResolver extends DefaultHandlerException
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
//hand manualy created exception
if (ex instanceof BaseWebException) {
return super.doResolveException(request, response, handler, ex);
}
UUID uuid = UUID.randomUUID();
logger.error("[{}] Found error in request {} with path {}", uuid, request.getMethod(), request.getRequestURI());
logger.error("["+uuid+"]", ex);

7
src/main/java/app/services/ProfileService.java

@ -5,6 +5,7 @@ import app.entities.Stats;
import app.entities.db.Ban;
import app.entities.db.Killfeed;
import app.entities.other.SteamID;
import app.exceptions.BaseWebException;
import app.services.db.*;
import app.services.steam.SteamWebApi;
import app.utils.SteamIDConverter;
@ -311,7 +312,7 @@ public class ProfileService {
return profile;
}
public class EmptyRequestPlayer extends RuntimeException {}
public class LowAdminPermition extends RuntimeException {}
public class NotFoundPlayer extends RuntimeException {}
public class EmptyRequestPlayer extends BaseWebException {}
public class LowAdminPermition extends BaseWebException {}
public class NotFoundPlayer extends BaseWebException {}
}

Loading…
Cancel
Save