2020-09-17 21:39:34 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
|
|
|
*
|
|
|
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
2020-10-28 13:35:15 +08:00
|
|
|
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found through the following link.
|
2020-09-17 21:39:34 +08:00
|
|
|
*
|
|
|
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
package net.mamoe.mirai.console.compiler.common.diagnostics
|
|
|
|
|
2020-10-30 10:28:18 +08:00
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_COMMAND_NAME
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_COMMAND_REGISTER_USE
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_PERMISSION_ID
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_PERMISSION_NAME
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_PERMISSION_NAMESPACE
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_PERMISSION_REGISTER_USE
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.ILLEGAL_PLUGIN_DESCRIPTION
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.NOT_CONSTRUCTABLE_TYPE
|
|
|
|
import net.mamoe.mirai.console.compiler.common.diagnostics.MiraiConsoleErrors.UNSERIALIZABLE_TYPE
|
2020-09-17 21:39:34 +08:00
|
|
|
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
|
|
|
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap
|
|
|
|
import org.jetbrains.kotlin.diagnostics.rendering.Renderers
|
|
|
|
|
|
|
|
object MiraiConsoleErrorsRendering : DefaultErrorMessages.Extension {
|
|
|
|
private val MAP = DiagnosticFactoryToRendererMap("MiraiConsole").apply {
|
|
|
|
put(
|
2020-09-18 01:49:08 +08:00
|
|
|
ILLEGAL_PLUGIN_DESCRIPTION,
|
|
|
|
"{0}",
|
2020-09-19 00:22:38 +08:00
|
|
|
Renderers.STRING,
|
2020-09-17 21:39:34 +08:00
|
|
|
)
|
2020-09-18 15:36:03 +08:00
|
|
|
|
|
|
|
put(
|
|
|
|
NOT_CONSTRUCTABLE_TYPE,
|
2020-09-19 00:22:38 +08:00
|
|
|
"类型 ''{0}'' 无法通过反射直接构造, 需要提供默认值.",
|
|
|
|
Renderers.STRING,
|
2020-09-18 15:36:03 +08:00
|
|
|
)
|
2020-09-18 20:00:47 +08:00
|
|
|
|
|
|
|
put(
|
|
|
|
UNSERIALIZABLE_TYPE,
|
2020-09-19 00:22:38 +08:00
|
|
|
"类型 ''{0}'' 无法被自动序列化, 需要添加序列化器",
|
2020-09-19 01:06:45 +08:00
|
|
|
Renderers.FQ_NAMES_IN_TYPES,
|
2020-09-19 00:22:38 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
put(
|
|
|
|
ILLEGAL_COMMAND_NAME,
|
|
|
|
"指令名 ''{0}'' 无效: {1}",
|
|
|
|
Renderers.STRING,
|
|
|
|
Renderers.STRING,
|
|
|
|
)
|
|
|
|
|
|
|
|
put(
|
|
|
|
ILLEGAL_PERMISSION_NAME,
|
|
|
|
"权限名 ''{0}'' 无效: {1}",
|
|
|
|
Renderers.STRING,
|
|
|
|
Renderers.STRING,
|
|
|
|
)
|
|
|
|
|
|
|
|
put(
|
|
|
|
ILLEGAL_PERMISSION_ID,
|
|
|
|
"权限 Id ''{0}'' 无效: {1}",
|
|
|
|
Renderers.STRING,
|
|
|
|
Renderers.STRING,
|
|
|
|
)
|
|
|
|
|
|
|
|
put(
|
|
|
|
ILLEGAL_PERMISSION_NAMESPACE,
|
|
|
|
"权限命名空间 ''{0}'' 无效: {1}",
|
|
|
|
Renderers.STRING,
|
|
|
|
Renderers.STRING,
|
2020-09-18 20:00:47 +08:00
|
|
|
)
|
2020-09-19 13:48:23 +08:00
|
|
|
|
|
|
|
put(
|
|
|
|
ILLEGAL_COMMAND_REGISTER_USE,
|
|
|
|
"''{0}'' 无法使用在 ''{1}'' 环境下.",
|
|
|
|
Renderers.DECLARATION_NAME,
|
|
|
|
Renderers.STRING
|
|
|
|
)
|
|
|
|
|
|
|
|
put(
|
|
|
|
ILLEGAL_PERMISSION_REGISTER_USE,
|
|
|
|
"''{0}'' 无法使用在 ''{1}'' 环境下.",
|
|
|
|
Renderers.DECLARATION_NAME,
|
|
|
|
Renderers.STRING
|
|
|
|
)
|
2020-09-17 21:39:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun getMap() = MAP
|
|
|
|
}
|