mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-26 20:20:14 +08:00
[core] Introduce UnsupportedCaptchaMethodException & UnsupportedQRCodeCaptchaException
This commit is contained in:
parent
7038d32aa5
commit
55dc5b3cf7
@ -72,16 +72,33 @@ public class NoStandardInputForCaptchaException @MiraiInternalApi constructor(
|
||||
public override val cause: Throwable? = null
|
||||
) : LoginFailedException(true, "no standard input for captcha")
|
||||
|
||||
/**
|
||||
* 当前 [LoginSolver] 不支持此验证方式
|
||||
*
|
||||
* @since 2.15
|
||||
*/
|
||||
public open class UnsupportedCaptchaMethodException : LoginFailedException {
|
||||
public constructor(killBot: Boolean) : super(killBot)
|
||||
public constructor(killBot: Boolean, message: String?) : super(killBot, message)
|
||||
public constructor(killBot: Boolean, message: String?, cause: Throwable?) : super(killBot, message, cause)
|
||||
public constructor(killBot: Boolean, cause: Throwable?) : super(killBot, cause = cause)
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要强制短信验证, 且当前 [LoginSolver] 不支持时抛出.
|
||||
* @since 2.13
|
||||
*/
|
||||
public class UnsupportedSmsLoginException(message: String?) : LoginFailedException(true, message)
|
||||
public class UnsupportedSmsLoginException(message: String?) : UnsupportedCaptchaMethodException(true, message)
|
||||
|
||||
/**
|
||||
* 无法完成滑块验证
|
||||
*/
|
||||
public class UnsupportedSliderCaptchaException(message: String?) : LoginFailedException(true, message)
|
||||
public class UnsupportedSliderCaptchaException(message: String?) : UnsupportedCaptchaMethodException(true, message)
|
||||
|
||||
/**
|
||||
* 需要二维码登录, 且当前 [LoginSolver] 不支持时抛出
|
||||
*/
|
||||
public class UnsupportedQRCodeCaptchaException(message: String?) : UnsupportedCaptchaMethodException(true, message)
|
||||
|
||||
/**
|
||||
* 非 mirai 实现的异常
|
||||
|
@ -16,6 +16,7 @@ import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.auth.QRCodeLoginListener
|
||||
import net.mamoe.mirai.network.LoginFailedException
|
||||
import net.mamoe.mirai.network.RetryLaterException
|
||||
import net.mamoe.mirai.network.UnsupportedQRCodeCaptchaException
|
||||
import net.mamoe.mirai.network.UnsupportedSmsLoginException
|
||||
import net.mamoe.mirai.utils.LoginSolver.Companion.Default
|
||||
import kotlin.jvm.JvmField
|
||||
@ -61,7 +62,7 @@ public abstract class LoginSolver {
|
||||
* @since 2.15
|
||||
*/
|
||||
public open fun createQRCodeLoginListener(bot: Bot): QRCodeLoginListener {
|
||||
throw UnsupportedSmsLoginException("This login session requires QRCode login, but current LoginSolver($this) does not support it. Please override `LoginSolver.createQRCodeLoginListener`.")
|
||||
throw UnsupportedQRCodeCaptchaException("This login session requires QRCode login, but current LoginSolver($this) does not support it. Please override `LoginSolver.createQRCodeLoginListener`.")
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user