初始化 monorepo: Go后端(7微服务) + Unity客户端(9模块) + 启动器 HTML5原型: Three.js 3D体素世界, Perlin噪声地形, 原版材质, 22种方块 Minecraft创造模式背包: 双栏布局, 拖拽移动物品, 方向性元件引脚 AI助搭策划文档 + 客户端/服务端骨架 + Docker Compose + CI
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
namespace PCL.Core.Minecraft.IdentityModel;
|
||||
|
||||
/// <summary>
|
||||
/// IdentityModel 模块异常基类。
|
||||
/// </summary>
|
||||
public class IdentityModelException(string message, Exception? innerException = null) : Exception(message, innerException);
|
||||
|
||||
/// <summary>
|
||||
/// IdentityModel 配置或元数据不满足当前认证流程要求时抛出的异常。
|
||||
/// </summary>
|
||||
public class IdentityModelConfigurationException(string message, Exception? innerException = null)
|
||||
: IdentityModelException(message, innerException);
|
||||
|
||||
/// <summary>
|
||||
/// 认证服务器返回 OAuth/Yggdrasil 协议错误时抛出的异常。
|
||||
/// </summary>
|
||||
/// <param name="error">协议错误代码。</param>
|
||||
/// <param name="errorDescription">协议错误描述。</param>
|
||||
/// <param name="innerException">内部异常。</param>
|
||||
public class IdentityModelAuthenticationException(
|
||||
string? error,
|
||||
string? errorDescription,
|
||||
Exception? innerException = null)
|
||||
: IdentityModelException(_BuildMessage(error, errorDescription), innerException)
|
||||
{
|
||||
/// <summary>
|
||||
/// 协议错误代码。
|
||||
/// </summary>
|
||||
public string? Error { get; } = error;
|
||||
|
||||
/// <summary>
|
||||
/// 协议错误描述。
|
||||
/// </summary>
|
||||
public string? ErrorDescription { get; } = errorDescription;
|
||||
|
||||
private static string _BuildMessage(string? error, string? errorDescription)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(error) && !string.IsNullOrWhiteSpace(errorDescription))
|
||||
return $"认证失败:{error} - {errorDescription}";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorDescription)) return $"认证失败:{errorDescription}";
|
||||
if (!string.IsNullOrWhiteSpace(error)) return $"认证失败:{error}";
|
||||
return "认证失败";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user