Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
Flags
safe-html, strict-same
Loading…
|
Translation uploaded |
|
|
String added in the repository |
|
However, as shown above these functions throw an exception if the kind in the <<ref_value>> does not match the kind denoted by the function signature. This can be used as a concise form of validation: access values as if they were the right type, but handle the resulting exception indicating if the schema of the JSON is not valid.然而,如上所示,如果 <<ref_value>> 中的实际类型与函数签名所指定的类型不匹配,这些函数会抛出异常。这一行为可作为一种简洁的验证形式:以预期类型直接访问值,若 JSON 结构无效,则通过捕获异常进行处理。</ref_value>