--[[-- JS / WebView 规则一律拒绝:抛出带固定提示的错误表,由 parser 转成用户可见的错误。 @module moonsource_legadorule.unsupported --]] local Regex = require("moonsource_legadorule.regex") local Unsupported = {} Unsupported.MESSAGE = "该书源需要 JS/WebView,暂不支持" local ErrMeta = { __tostring = function(e) return e.message end } function Unsupported.fail() error(setmetatable({ message = Unsupported.MESSAGE, unsupported = true }, ErrMeta), 0) end --- pcall 抛出的错误转成文字。 function Unsupported.message(err) if type(err) == "table" and err.message then return err.message end return tostring(err) end function Unsupported.isJsSnippet(text) return Regex.test("(?i)