9 changed files with 91 additions and 14 deletions
@ -0,0 +1,35 @@ |
|||||||
|
package com.cloud.kicc.common.core.enums; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* API错误页面响应状态枚举 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: wangxiang4 |
||||||
|
* @Since: 2023/8/16 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@RequiredArgsConstructor |
||||||
|
public enum ExceptionEnum { |
||||||
|
|
||||||
|
UNAUTHORIZED_ACCESS(401, "禁止访问"), |
||||||
|
PAGE_NOT_ACCESS(403, "页面无法访问"), |
||||||
|
PAGE_NOT_FOUND(404, "网页未找到"), |
||||||
|
ERROR(500, "错误"), |
||||||
|
NET_WORK_ERROR(10000, "前端Js错误"), |
||||||
|
PAGE_NOT_DATA(10100, "无数据页面"); |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态 |
||||||
|
*/ |
||||||
|
private final int value; |
||||||
|
|
||||||
|
/** |
||||||
|
* 描述 |
||||||
|
*/ |
||||||
|
private final String description; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package com.cloud.kicc.common.security.exception; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
import org.springframework.http.HttpStatus; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* 未配置用户数据 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: wangxiang4 |
||||||
|
* @Since: 2023/9/2 |
||||||
|
*/ |
||||||
|
@JsonSerialize(using = KiccAuth2ExceptionSerializer.class) |
||||||
|
public class UnConfiguredUserDataException extends KiccAuth2Exception { |
||||||
|
|
||||||
|
public UnConfiguredUserDataException(String msg) { |
||||||
|
super(msg); |
||||||
|
} |
||||||
|
|
||||||
|
public UnConfiguredUserDataException(String msg, Throwable t) { |
||||||
|
super(msg, t); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getOAuth2ErrorCode() { |
||||||
|
return "un_configured_user_data"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int getHttpErrorCode() { |
||||||
|
return HttpStatus.NETWORK_AUTHENTICATION_REQUIRED.value(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue