
ErrorModel = function (appId) {
  var self = this;
  this.appId = appId;
  this.errors = {};
  this.startTime = Date.now();
}

_.extend(ErrorModel.prototype, KadiraModel.prototype);

ErrorModel.prototype.buildPayload = function() {
  var metrics = _.values(this.errors);
  this.startTime = Date.now();
  this.errors = {};
  return {errors: metrics};
};

ErrorModel.prototype.trackError = function(ex, source) {
  var name = ex.name + ': ' + ex.message;
  if(this.errors[name]) {
    this.errors[name].count++;
  } else {
    this.errors[name] = this._formatError(ex, source);
  }
};

ErrorModel.prototype._formatError = function(ex, source) {
  var name = ex.name + ': ' + ex.message;
  var now = Date.now();
  return {
    appId : this.appId,
    name : name,
    source : source,
    startTime : now,
    type : 'server',
    stack : [{at: now, events: [], stack: ex.stack}],
    count: 1,
  }
};

@@ -409,50 +409,8 @@
 ) %7B%0A
-  var name = ex.name + ': ' + ex.message;%0A
   if
@@ -422,19 +422,25 @@
 .errors%5B
-nam
+ex.messag
 e%5D) %7B%0A  
@@ -453,19 +453,25 @@
 .errors%5B
-nam
+ex.messag
 e%5D.count
@@ -501,19 +501,25 @@
 .errors%5B
-nam
+ex.messag
 e%5D = thi
@@ -617,50 +617,8 @@
 ) %7B%0A
-  var name = ex.name + ': ' + ex.message;%0A
   va
@@ -683,19 +683,25 @@
  name : 
-nam
+ex.messag
 e,%0A    s

Use e.message as error name