Comments (7)
也对,我加下unhandledRejection的支持
from puerts.
“将js方法注册为button的点击事件”,这个会变成c#异常啊。不会看不到报错。
“j某个异步方法内抛出异常”,这个看js的文档,可以catch,demo也有例子。
from puerts.
很多业务开发不会去主动写catch的, 例如有个async func(){ throw new Error(); } 业务上就调用了了 func(); 没有去await也没有去.catch(). 就算上层有try或.catch(), 也不会拿到这个异常的嘛, 这样这个异常就没地方可捕获. 浏览器可以通过全局的error事件捕获到这个异常, nodejs可以通过uncaughtException捕获到
from puerts.
将js方法注册为button的点击事件, 如果注册的是一个async方法, 那么是不会变为C#异常的, 看不到报错. 注册同步方法是没问题的.
这问题和上面的一样, 异步执行的方法没有主动捕获就拿不到异常.
from puerts.
那归根到底还是异步方法的异常。
异步方法必须这样catch,这是js的规范,我不可能改这点的,只能你们去适应了。
from puerts.
在浏览器和nodejs上, 都能拿到没有catch的异常呢.
说真的, 业务开发要按照规范编写catch非常痛苦, 很多场景都是不关心异常, 但出现异常又能被知晓
from puerts.
支持unhandledRejection了,使用上可以先参考ut用例:https://github.com/Tencent/puerts/blob/master/unity/general/Src/UnitTest/UnitTest.cs#L951
from puerts.
Related Issues (20)
- [UE] 萌新不清楚,为什么调用UE.uproperty注解会失效,但是import uproperty 之后直接调用uproperty是正常的 HOT 3
- ts写动画蓝图逻辑怎么样,蓝图里面的property access ts支持嘛,还遇到了一个应该是bug HOT 1
- [UE] Bug: 为ts UMG创建子类,蓝图全编译报循环引用错误 HOT 4
- [UE] Bug: JsEnvImpl的构造函数在纯v8的环境下没有正确处理传入的InFlags HOT 4
- [UE] 蓝图代理的方法能否支持默认值 HOT 1
- [UE] Bug: 在setTimeout中清理自身后,嵌套的setInterval和setTimeout不会执行 HOT 2
- [UE] Bug: console.log setTimeout 让UMG引用增加无法卸载 HOT 1
- [Unity] Bug: $typeof 操作嵌套命名空间内的类型时返回 undefined HOT 3
- [UE] 有关于新的定时器id复用机制容易导致错误清除的问题 HOT 13
- [Unity]/[UE] suggestion 创建jsenv时候增加一些优化参数如:set_max_old_generation_size_in_bytes HOT 2
- [UE] Bug: ue_bp.d.ts在引用插件里蓝图的地方报错,请问有什么比较好的解决办法 HOT 4
- [UE] Bug: promises.js,没有同步Unity下, kPromiseRejectWithNoHandler run after all microtasks 的修改 HOT 2
- [UE] Bug: Mixin 基类,PIE第二次启动后会崩溃 HOT 5
- [UE] suggestion 建议将用户js目录移动一下 HOT 2
- [UE] Bug: mixin 覆盖的函数中调用super 异常 HOT 2
- [Unity] General Questions HOT 5
- [UE] Bug: 使用Puerts Axios Http上传文件的问题 HOT 3
- [Question] Does the project use IPC or embedded process? HOT 1
- [UE] Bug: error: no template named 'result_of' HOT 2
- [UE] Bug: Dynamic Delegate无法区分MulticastDelegate和Single Delegate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puerts.