对LuaException进行定义:lua代码和error方法抛出的异常才是LuaException #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
当前的lua扩展有一个很大的问题:把一个PHP方法registerCallback给lua之后,如果lua调用这个方法出现php的异常,lua的代码还是会继续往下走,示例:
以上是题外话,但是和这个改进相关。当lua侧代码出现了问题需要终止的时候,只有一种终止方法,那就是error方法。php侧需要捕获这个异常做一些特殊处理的时候只需要判断
$e instanceof \LuaException
。其次 php 需要得到 error 方法的参数,示例: