Flex 应用程序的错误报告
我有一个 Flex 3 应用程序,我想通过简单的 HTTPService 调用将应用程序生成的错误报告给服务器。
我的想法是将所有方法包装在 try ... catch 块中,然后将 Error 对象传递给 reportError() 函数(然后触发 HTTP 请求并弹出一个对话框),但是有更好的方法吗?
I have a Flex 3 app which I want to instrument to report errors generated by the app to a server via simple HTTPService call.
My idea is to wrap all the methods in try ... catch blocks which then pass the Error object to the reportError() function (which then fires off the HTTP request and pops up a dialog) but is there a better way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经实现了一个系统,例如您建议的系统,将我的所有方法包装在 try/catch 中,并将堆栈跟踪发送到通过电子邮件向我发送错误的服务。 我为错误创建了一个基本格式,用于记录错误发生的方法。我注意到有时我最终会从堆栈跟踪中获取 null,因此我想记录这些情况的信息。
它极大地改善了我的申请。 我追踪到了一些(大量)错误,并向我的用户发布了一个更清晰的版本。 现在我再也收不到电子邮件了。
I have implemented a system such as the one you suggest, wrapping all of my methods in try/catch and sending the stack trace to a service that emails me the errors. I created a basic format for the error that logs which method the error occurred in. I noticed that sometimes I end up getting null from the stack traces, so I wanted to log that information for these situations.
It GREATLY improved my application. I tracked down a (large) handful of errors and released a much cleaner build to my users. Now I don't ever get the emails.
IMO 更好的方法是这个。
我不知道这个特定项目有多好(除了这个令人毛骨悚然的 GPL 许可证),但我不明白为什么登录操作脚本应该与 J2EE、C++ 或 Python 有任何不同。 是的,它有一些沙箱安全问题,但我认为如果这个问题解决了,您可以登录到一些集中式日志服务器。
The better way IMO is something like this.
I've no idea how good is this particular project (aside from this spooky GPL license), but I don't see why logging in action script should be any different from J2EE, C++, or say Python. Yes, it has some sand box security issues, but I think if this solved, you could log into some centralized log server..
不幸的是,实际上并不存在错误——错误不会以可在全局级别捕获的方式冒泡,因此捕获错误的唯一真正方法是尝试手动捕获所有错误。 (一段时间以来,社区一直强烈要求提供全局异常处理功能,但目前还没有。)
Unfortunately, there really isn't -- errors don't bubble up in such a way as to be trappable at a global level, so the only real way you have to catch errors is to try and catch them all manually. (The community's been pretty vocal in asking for a global exception-handling feature for a while, but it's not there yet.)