clean up error handling a bit.

This commit is contained in:
Misko Hevery 2010-07-20 17:13:31 -07:00
parent 0f4b068bd6
commit 719f6e15a0
2 changed files with 1 additions and 34 deletions

View file

@ -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) {

View file

@ -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) {