mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-03-29 00:09:01 +08:00
clean up error handling a bit.
This commit is contained in:
@@ -30,10 +30,6 @@ var consoleNode,
|
||||
angularCallbacks = extensionMap(angular, 'callbacks'),
|
||||
nodeName;
|
||||
|
||||
function angularAlert(){
|
||||
log(arguments); window.alert.apply(window, arguments);
|
||||
}
|
||||
|
||||
function foreach(obj, iterator, context) {
|
||||
var key;
|
||||
if (obj) {
|
||||
@@ -178,21 +174,6 @@ function indexOf(array, obj) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
function log(a, b, c){
|
||||
var console = window['console'];
|
||||
switch(arguments.length) {
|
||||
case 1:
|
||||
console['log'](a);
|
||||
break;
|
||||
case 2:
|
||||
console['log'](a, b);
|
||||
break;
|
||||
default:
|
||||
console['log'](a, b, c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function error(a, b, c){
|
||||
var console = window['console'];
|
||||
switch(arguments.length) {
|
||||
@@ -208,20 +189,6 @@ function error(a, b, c){
|
||||
}
|
||||
}
|
||||
|
||||
function consoleLog(level, objs) {
|
||||
var log = document.createElement("div");
|
||||
log.className = level;
|
||||
var msg = "";
|
||||
var sep = "";
|
||||
for ( var i = 0; i < objs.length; i++) {
|
||||
var obj = objs[i];
|
||||
msg += sep + (typeof obj == 'string' ? obj : toJson(obj));
|
||||
sep = " ";
|
||||
}
|
||||
log.appendChild(document.createTextNode(msg));
|
||||
consoleNode.appendChild(log);
|
||||
}
|
||||
|
||||
function isLeafNode (node) {
|
||||
if (node) {
|
||||
switch (node.nodeName) {
|
||||
|
||||
@@ -147,7 +147,7 @@ function createScope(parent, services, existing) {
|
||||
try {
|
||||
return expressionCompile(expression).apply(instance, slice.call(arguments, 2, arguments.length));
|
||||
} catch (e) {
|
||||
error(e);
|
||||
(instance.$log || {error:error}).error(e);
|
||||
if (isFunction(exceptionHandler)) {
|
||||
exceptionHandler(e);
|
||||
} else if (exceptionHandler) {
|
||||
|
||||
Reference in New Issue
Block a user