Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

渲染进程invoke无法正常try-catch捕获异常 #117

Open
zcoresion opened this issue Jul 6, 2024 · 0 comments
Open

渲染进程invoke无法正常try-catch捕获异常 #117

zcoresion opened this issue Jul 6, 2024 · 0 comments

Comments

@zcoresion
Copy link

  • 问题描述:通过ipcRender.invoke调用主进程服务,主进程报错后将error直接当成正常结果返回了回来,无法通过try-catch捕获

  • 问题原因:ee-core\socket\ipcServer.js:105,捕获到异常后的处理方式是return而不是throw
    Snipaste_2024-07-06_12-57-09

  • 个人建议:如果不希望前台处理任何后台的异常,应该直接拒绝将异常返回给前台;如果能够将异常返回给前台,应该使用常规的异常抛出逻辑,以便前台也能按照常规逻辑处理(以上仅个人观点)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant