mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-17 21:31:02 +00:00
clean up error handling a bit.
This commit is contained in:
parent
0f4b068bd6
commit
719f6e15a0
2 changed files with 1 additions and 34 deletions
|
|
@ -30,10 +30,6 @@ var consoleNode,
|
||||||
angularCallbacks = extensionMap(angular, 'callbacks'),
|
angularCallbacks = extensionMap(angular, 'callbacks'),
|
||||||
nodeName;
|
nodeName;
|
||||||
|
|
||||||
function angularAlert(){
|
|
||||||
log(arguments); window.alert.apply(window, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function foreach(obj, iterator, context) {
|
function foreach(obj, iterator, context) {
|
||||||
var key;
|
var key;
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
|
@ -178,21 +174,6 @@ function indexOf(array, obj) {
|
||||||
return -1;
|
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){
|
function error(a, b, c){
|
||||||
var console = window['console'];
|
var console = window['console'];
|
||||||
switch(arguments.length) {
|
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) {
|
function isLeafNode (node) {
|
||||||
if (node) {
|
if (node) {
|
||||||
switch (node.nodeName) {
|
switch (node.nodeName) {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ function createScope(parent, services, existing) {
|
||||||
try {
|
try {
|
||||||
return expressionCompile(expression).apply(instance, slice.call(arguments, 2, arguments.length));
|
return expressionCompile(expression).apply(instance, slice.call(arguments, 2, arguments.length));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error(e);
|
(instance.$log || {error:error}).error(e);
|
||||||
if (isFunction(exceptionHandler)) {
|
if (isFunction(exceptionHandler)) {
|
||||||
exceptionHandler(e);
|
exceptionHandler(e);
|
||||||
} else if (exceptionHandler) {
|
} else if (exceptionHandler) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue