mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-02-03 18:45:32 +08:00
* 🔧 修改 basedpyright 配置 * 🚨 auto fix by pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
from typing_extensions import override
|
|
|
|
|
|
class TetrisStatsError(Exception):
|
|
"""所有 TetrisStats 发生的异常基类"""
|
|
|
|
def __init__(self, message: str = ''):
|
|
self.message = message
|
|
|
|
@override
|
|
def __str__(self) -> str:
|
|
return self.message
|
|
|
|
@override
|
|
def __repr__(self) -> str:
|
|
return self.message
|
|
|
|
|
|
class NeedCatchError(TetrisStatsError):
|
|
"""需要被捕获的异常基类"""
|
|
|
|
|
|
class RequestError(NeedCatchError):
|
|
"""请求错误"""
|
|
|
|
def __init__(self, message: str = '', *, status_code: int | None = None):
|
|
super().__init__(message)
|
|
self.status_code = status_code
|
|
|
|
|
|
class MessageFormatError(NeedCatchError):
|
|
"""用户发送的消息格式不正确"""
|
|
|
|
|
|
class RecordNotFoundError(NeedCatchError):
|
|
"""找不到用户的某种记录"""
|
|
|
|
|
|
class FallbackError(NeedCatchError):
|
|
"""需要回滚至更通用的方法"""
|
|
|
|
|
|
class DoNotCatchError(TetrisStatsError):
|
|
"""不应该被捕获的异常基类"""
|
|
|
|
|
|
class WhatTheFuckError(DoNotCatchError):
|
|
"""用于表示不应该出现的情况 ("""
|
|
|
|
|
|
class NoFallbackError(DoNotCatchError): # 暂时没用 但是先写了
|
|
"""没有可用的回退方法"""
|