docs: update api-exception, example

This commit is contained in:
2023-10-07 11:17:35 +08:00
parent 94ffac84bc
commit 8462d9cb34
4 changed files with 8 additions and 124 deletions

View File

@@ -1080,48 +1080,6 @@ Please make sure you have loaded the `encase` method of `YukiHookAPI` in the cor
###### exception
::: danger UnsupportedOperationException
!!!DANGEROUS!!! Hook \[**CLASS**\] Class is a dangerous behavior! \[**CONTENT**\] \[**SOLVE**\]
:::
**Abnormal**
You tried to hook a `Class` object in the list of dangerous behaviors, such as `Class`, `ClassLoader`, `Method`.
> The following example
```kotlin
// <Scenario 1>
JavaClassLoader.hook {
// ...
}
// <Scenario 2>
JavaClass.hook {
// ...
}
// <Scenario 3>
JavaMethod.hook {
// ...
}
// ...
```
**Solution**
These functions are internal to the system, <u>**they should not be hooked, may not be supported on some Hook Frameworks, and may cause other errors**</u>, please try to replace the hook point.
::: tip
If you still want to use this feature, please refer to [YukiMemberHookCreator.useDangerousOperation](../api/public/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator#usedangerousoperation-method) method.
But **It is strongly recommended not to do this, please do not report any problems, <u>all the consequences will be borne by yourself</u>**.
:::
###### exception
::: danger NoClassDefFoundError
Can't find this Class in \[**CLASSLOADER**\]: **CONTENT** Generated by YukiHookAPI#ReflectionTool
@@ -1847,22 +1805,6 @@ For details, please refer to [Status Monitor](../guide/example#status-monitor).
::: danger IllegalStateException
This hook instance is create by Members, not support any hook class instance
:::
**Abnormal**
Hook instance is created using `Member.hook { ... }` instead of `Class.hook { ... }` and uses `instanceClass`.
**Solution**
You can only use `instanceClass` if you created a Hook instance using `Class.hook { ... }`.
###### exception
::: danger IllegalStateException
Use of searchClass { ... }.hook { ... } is an error, please use like searchClass { ... }.get()?.hook { ... }
:::