- 浏览: 1064172 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (695)
- 心情日记 (14)
- AS开发工具 (12)
- 文章转载 (99)
- AIR (5)
- 问题总结 (46)
- SWF格式 (7)
- 测试总结 (10)
- 外文资料 (9)
- 算法技术 (33)
- AS3常用开源库 (43)
- 源码范例 (102)
- FLEX (72)
- FLASH 优化 (33)
- 游戏开发 (49)
- 开发技术 (11)
- 工作应用 (34)
- AS3收集 (140)
- WebBase (0)
- 开发构想 (4)
- 设计模式 (2)
- 框架和框架范例 (19)
- RED5 (3)
- java开发 (3)
- JAVA (1)
- FLASH-3D (23)
- 3D (6)
- 书籍 (10)
- 业界信息资料 (3)
- C# (1)
- JavaScript (12)
- HTML5 (6)
- Flixel (1)
- D5Power RPG网页游戏引擎 (0)
- ColorMatrixFilter - 获得相应颜色的色调 函数 (0)
- Starling (0)
最新评论
-
老顽童203:
字体
水果忍者鼠标跟随特效制作[转载] -
hairball00:
[转] 放出超多的Flash组件源代码 -
he74552775:
flash AS3 RegExp简单功能用法(转) -
hanshuai1232000:
第四点,有利也有弊,等你做了大型的aprg,你就知道了
[转]位图数据内存优化 -
yangfantao:
太感谢
[转] 放出超多的Flash组件源代码
http://flex4jiaocheng.com/blog/347
The new global error handler enables developers to write a single handler to process all runtime errors that weren’t part of a try/catch statement. Improve application reliability and user experience by catching and handling unexpected runtime errors and present custom error messages.
新的全局错误处理(Global Error Handler)让开发人员编只写一个处理过程就能在运行时处理所有的错误,而不需要一个一个得try/catch。它能捕获和处理未知的运行时错误,并自定义错误消息,大大改善应用程序的可靠性和用户体验。
Registering for uncaught errors is hugely convenient, but it doesn’t entirely excuse developers from handling errors where they’re most likely to happen. For instance, you should still always register for things like IOError events and other errors that are likely to happen at some point, and that you can usually recover from. But starting with AIR 2.0 (and FP 10.1), you will also be able to register globally for errors that you weren’t able to anticipate, and handle them at least somewhat gracefully.
虽然为不能捕捉的错误注册监听是非常的方便,但这不能成为开发者逃避处理最可能发生错误地方的借口。例如,你必须为像IOError这一类的事件注册监听,因为他们随时可能发生,并且你可以修复他们。但是从Air2.0(FP 10.1)开始,你将能为那些你不能预先估计的错误进行全局注册监听,而且从某种程度来说优雅的解决他们。
The big question is what you do once you’ve caught an unhandled error. That will probably depend on the application. Since it’s likely that a function exited without executing all the way through, there’s no telling what state your app will be in. The safest thing to do is probably to log the error, show a very contrite dialog box, and then exit the app (after all, if the error had been predictable and easy to recover from, you should have caught it explicitly). You might try sending the error message to your server, including instructions for emailing the log file to a support email address, or if it’s an internal application, provide a telephone extension to call for someone to come take a look. It’s entirely up to you. We provide the API, you provide the solution.
最大的问题是你该要做什么当捕捉到一个未经处理的错误。这可能取决于应用程序,因为你可以随时的结束一个程序,所以你将不会被告知你的程序的状态,最安全的方式可能就是用一个日志记录器来记录错误,然后再结束程序。(如果这个错误是可被预测的而且很容易被解决,你应该明确的捕捉它。)你应该尝试让应用程序发送错误消息到你的服务器,包括将其寄送到服务邮箱地址,如果这是一个内部程序,你也应该提供一个电话能让某人来解决问题。最后提醒一句,我们提供API,你提供解决方案。
API找到的都是WindowedApplication的例子,那我就来写一个Application的吧。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="onApplicationComplete()">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
private function onApplicationComplete():void{
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
}
private function onUncaughtError(event:UncaughtErrorEvent):void{
var message:String = event.error.getStackTrace();
if(!message){
if(event.error is Error){
message = Error(event.error).message;
}
else if(event.error is ErrorEvent){
message = ErrorEvent(event.error).text;
}
else{
message = event.error.toString();
}
}
Alert.show(message);
}
private function onCauseError(e:MouseEvent):void{
var foo:String = null;
Alert.show(foo.length.toString());
}
]]>
</fx:Script>
<s:Button label="Cause TypeError" click="onCauseError(event)" verticalCenter="0" horizontalCenter="0"/>
</s:Application>
虽然全局错误处理(Global Error Handler)能catch到未知Error,但是catch到的信息是和FP的版本有关的。
release版Flash Player
debug版Flash Player
Adobe文章:http://blogs.adobe.com/cantrell/archives/2009/10/global_error_handling_in_air_20.html
P.S.
想要使用全局错误处理(Global Error Handler)必须将你的SDK或Flash Builder升级至最新版本。
Flex4 SDK:http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex4sdk
Flash Builder 4.0.1 updater:http://www.adobe.com/support/flex/downloads_updaters.html
当然你的AIR和FP也要升级至标题中写的版本。
The new global error handler enables developers to write a single handler to process all runtime errors that weren’t part of a try/catch statement. Improve application reliability and user experience by catching and handling unexpected runtime errors and present custom error messages.
新的全局错误处理(Global Error Handler)让开发人员编只写一个处理过程就能在运行时处理所有的错误,而不需要一个一个得try/catch。它能捕获和处理未知的运行时错误,并自定义错误消息,大大改善应用程序的可靠性和用户体验。
Registering for uncaught errors is hugely convenient, but it doesn’t entirely excuse developers from handling errors where they’re most likely to happen. For instance, you should still always register for things like IOError events and other errors that are likely to happen at some point, and that you can usually recover from. But starting with AIR 2.0 (and FP 10.1), you will also be able to register globally for errors that you weren’t able to anticipate, and handle them at least somewhat gracefully.
虽然为不能捕捉的错误注册监听是非常的方便,但这不能成为开发者逃避处理最可能发生错误地方的借口。例如,你必须为像IOError这一类的事件注册监听,因为他们随时可能发生,并且你可以修复他们。但是从Air2.0(FP 10.1)开始,你将能为那些你不能预先估计的错误进行全局注册监听,而且从某种程度来说优雅的解决他们。
The big question is what you do once you’ve caught an unhandled error. That will probably depend on the application. Since it’s likely that a function exited without executing all the way through, there’s no telling what state your app will be in. The safest thing to do is probably to log the error, show a very contrite dialog box, and then exit the app (after all, if the error had been predictable and easy to recover from, you should have caught it explicitly). You might try sending the error message to your server, including instructions for emailing the log file to a support email address, or if it’s an internal application, provide a telephone extension to call for someone to come take a look. It’s entirely up to you. We provide the API, you provide the solution.
最大的问题是你该要做什么当捕捉到一个未经处理的错误。这可能取决于应用程序,因为你可以随时的结束一个程序,所以你将不会被告知你的程序的状态,最安全的方式可能就是用一个日志记录器来记录错误,然后再结束程序。(如果这个错误是可被预测的而且很容易被解决,你应该明确的捕捉它。)你应该尝试让应用程序发送错误消息到你的服务器,包括将其寄送到服务邮箱地址,如果这是一个内部程序,你也应该提供一个电话能让某人来解决问题。最后提醒一句,我们提供API,你提供解决方案。
API找到的都是WindowedApplication的例子,那我就来写一个Application的吧。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="onApplicationComplete()">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
private function onApplicationComplete():void{
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
}
private function onUncaughtError(event:UncaughtErrorEvent):void{
var message:String = event.error.getStackTrace();
if(!message){
if(event.error is Error){
message = Error(event.error).message;
}
else if(event.error is ErrorEvent){
message = ErrorEvent(event.error).text;
}
else{
message = event.error.toString();
}
}
Alert.show(message);
}
private function onCauseError(e:MouseEvent):void{
var foo:String = null;
Alert.show(foo.length.toString());
}
]]>
</fx:Script>
<s:Button label="Cause TypeError" click="onCauseError(event)" verticalCenter="0" horizontalCenter="0"/>
</s:Application>
虽然全局错误处理(Global Error Handler)能catch到未知Error,但是catch到的信息是和FP的版本有关的。
release版Flash Player
debug版Flash Player
Adobe文章:http://blogs.adobe.com/cantrell/archives/2009/10/global_error_handling_in_air_20.html
P.S.
想要使用全局错误处理(Global Error Handler)必须将你的SDK或Flash Builder升级至最新版本。
Flex4 SDK:http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex4sdk
Flash Builder 4.0.1 updater:http://www.adobe.com/support/flex/downloads_updaters.html
当然你的AIR和FP也要升级至标题中写的版本。
发表评论
-
HTTP/1.1协议规范(中文归纳版)
2012-04-18 16:39 2031一、介绍(introduction) ... -
[转] [Flash/Flex] 加载SWF性能VS影片剪辑性能
2012-03-15 22:29 0http://bbs.9ria.com/viewthread. ... -
请问如何才能让加载到一半的SWF不自动播放
2012-02-29 03:06 1484我用loader加载l=new Loader(); ... -
Embed绑定XML与txt文本文件
2011-12-28 15:54 4611使用Embed标签可以将图片绑定到swf中并显示,那么我 ... -
Flash_Rich_Text_Editor(完美的富文本编辑器)
2011-12-27 17:55 0Flash_Rich_Text_Editor(完美的富文 ... -
Matrix学习
2011-11-28 16:51 0Matrix学习 -
[转]三次贝尔曲线
2011-11-10 01:09 1878http://bbs.9ria.com/viewt ... -
[心得] 完美解决as3在ie中初始化时stageWidth和stageHeight为0的问题
2011-11-03 00:46 2892先看下面的一段脚本,这是比较经典的初始化脚本: pa ... -
Flash Player和Adobe AIR内部的垃圾回收机制
2011-10-29 22:37 0资讯类型: 翻译 来源页面: http://www.ad ... -
[转]FLASH与JS序列简单应用
2011-10-28 01:03 2036FLASH与JS序列简单应用 (一) 用swfob ... -
2个加载作用
2011-10-24 22:14 1828第一话:加载Base64 encoded string 通过 ... -
[原创]围绕任意一个中心点旋转
2011-10-23 13:46 0package guwanyuan.qicool.game.c ... -
[转]這是一個多分頁打印的類
2011-10-23 00:12 1370http://bbs.9ria.com/viewthread. ... -
[心得] localToGlobal 和 globalToLocal 的理解
2011-10-20 03:10 0http://bbs.9ria.com/viewthread. ... -
翻译: Flash文本引擎, 第三部分: 布局
2011-10-20 02:36 0http://www.riade ... -
翻译: Flash文本引擎, 第二部分: 交互
2011-10-20 02:34 0http://www.riadev.com/flex-thre ... -
翻译: Flash文本引擎, 第一部分: 概述
2011-10-20 02:33 0http://www.riadev.com/flex-thre ... -
海洋效果非常绚丽
2011-09-30 02:17 0海洋效果非常绚丽 -
[转][心得] numChildren > 0, getChildAt(0)却是null?
2011-09-25 00:55 0if(numChildren) ... -
[转]批量生成swf资源文件 JSFL
2011-09-22 22:58 0发布文件夹里的所有flash.jsfl var fol ...
相关推荐
Yii 2.x应用程序中的自定义错误处理 该模块允许您将其处理挂在Exceptions上。 ###何时需要###例如,捕获“危险”的用户操作。 发生错误时,您可以记录数据并跟踪特定用户或IP的ForbiddenHttpException或...
Laravel开发-laravel-error-handler Laravel 5框架的错误处理程序包
异常处理相关的方案仅供参考。异常处理相关的方案仅供参考。
ABB机器人错误处理方法
MySQL存储过程 ERROR Handler 异常处理
错误处理模块 该模块提供了一种在Express应用程序中处理错误的方法,该方法具有一些创建错误的方法和一个Express Error中间件handleHttpError 。安装npm install --save error-handler-module基本错误类型我们设置了...
在生产模式下, strong-error-handler忽略错误响应中的详细信息,以防止泄露敏感信息: 对于5xx错误,输出仅包含HTTP规范中的状态代码和状态名称。 对于4xx错误,输出包含完整的错误消息( error.message )和...
表达错误处理者 Express应用程序的优美错误处理程序。 这也修补了DOS漏洞,用户可以在其中手动触发严重的请求错误,从而关闭您的应用程序。 快速开始: var express = require ( 'express' ) , errorHandler = ...
Method运行错误(非语法错误)的处理(不弹出Debug窗口及ErrorHandler)
强错误处理程序这个包是一个用于开发(调试)和生产环境的错误处理程序。 在生产模式下, strong-error-handler从错误响应中省略详细信息以防止泄露敏感信息: 对于 5xx 错误,输出仅包含 HTTP 规范中的状态代码和...
快速路由错误处理程序 例子 const express = require('express'); const errorHandler = require('express-route-error-handler); const app = express();...在[1]中引发的任何错误都将在[2]中处理
set_error_handler() 函数设置用户自定义的错误处理函数。该函数用于创建运行时期间的用户自己的错误处理方法。该函数会返回旧的错误处理程序,若失败,则返回 null。 下面来看一些例子。 set_error_handler() ...
React本机异常处理程序 React Native模块,使您可以注册一个全局错误处理程序,该错误处理程序可以捕获致命/非致命未捕获异常。 该模块有助于防止RN Apps突然崩溃,而不会向用户显示优美的消息。 在当前情况下: ...
简单的错误和异常处理程序: 根据错误报告级别将错误转换为ErrorException实例 运行PHP CLI ,向STDERR报告错误/异常(甚至是致命错误)并使用异常代码作为退出状态 允许停用@运算符 捕获致命错误 接受在内部关闭...
(2)堆区(heap):一般由程序员分配和释放,若程序员不释放,程序结束时可能由操作系统回收 (3)全局区(静态区)(static):全局变量和静态变量的存储是
Android中handler的使用,处理多线程的使用
错误处理程序Mongo数据库的错误处理程序安装安装此扩展的首选方法是通过 。 无论运行composer require --prefer-dist taguz91/yii2-error-handler或添加"taguz91/yii2-error-handler": "~1.0.0"到composer.json文件...
Handler在子线程中的使用以及注意事项
测试Thread中使用Handler修改
默认情况下,全局错误会直接输出,但是最近开发时使用的一个框架库对全局错误处理进行了设定,导致很多错误信息没有输出,在定位问题上有一定的耗时。所以,研究了一下此库的实现,发现它设定了error_reporting和set...