Files
MRCC/launcher/PCL-CE/PCL.Core/Minecraft/IdentityModel/IdentityModelException.cs
T
xyou f70b061d1a
CI / Go Backend (push) Canceled after 0s
feat: 项目初始化 + 3D方块世界原型 + AI助搭系统
初始化 monorepo: Go后端(7微服务) + Unity客户端(9模块) + 启动器

HTML5原型: Three.js 3D体素世界, Perlin噪声地形, 原版材质, 22种方块

Minecraft创造模式背包: 双栏布局, 拖拽移动物品, 方向性元件引脚

AI助搭策划文档 + 客户端/服务端骨架 + Docker Compose + CI
2026-08-08 14:07:56 +08:00

48 lines
1.7 KiB
C#

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 "认证失败";
}
}