2025-05-01 03:59:37 +08:00

49 lines
1.1 KiB
TypeScript

export enum ErrorCode {
/** 网络连接异常,请检查网络设置或重启试试 */
IP_BLOCK = 300012,
/** 笔记状态异常,请稍后查看 */
NOTE_ABNORMAL = -510001,
/** 当前内容无法展示 */
NOTE_SECRETE_FAULT = -510001,
/** 浏览器异常,请尝试关闭/卸载风险插件或重启试试! */
SIGN_FAULT = 300015,
/** 登录已过期 */
SESSION_EXPIRED = -100
}
export class XhsError extends Error {
response?: Response;
verifyType?: string;
verifyUuid?: string;
constructor(
message: string,
options?: {
response?: Response;
verifyType?: string;
verifyUuid?: string;
}
) {
super(message);
this.response = options?.response;
this.verifyType = options?.verifyType;
this.verifyUuid = options?.verifyUuid;
}
}
export class DataFetchError extends XhsError {}
export class IPBlockError extends XhsError {}
export class SignError extends XhsError {}
export class NeedVerifyError extends XhsError {
constructor(
message: string,
options?: {
verifyType?: string;
verifyUuid?: string;
}
) {
super(message, options);
}
}