Skip to content

Commit

Permalink
[BUGFIX release] Fix Ember.Error inheritance
Browse files Browse the repository at this point in the history
As pointed out by @schuay #15516 our error constructor essentially calls super twice. The reasons seems to have been an error in ExtendableBuiltin constructor, which did not return its `apply` call. I can’t seem to find the issue ExtendBuiltin is working around. I suspect we can simply remove it
  • Loading branch information
stefanpenner committed Jul 17, 2017
1 parent cfabfc3 commit b6ee5e0
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions packages/ember-debug/lib/error.js
@@ -1,14 +1,3 @@

function ExtendBuiltin(klass) {
function ExtendableBuiltin() {
klass.apply(this, arguments);
}

ExtendableBuiltin.prototype = Object.create(klass.prototype);
ExtendableBuiltin.prototype.constructor = ExtendableBuiltin;
return ExtendableBuiltin;
}

/**
A subclass of the JavaScript Error object for use in Ember.
Expand All @@ -18,15 +7,10 @@ function ExtendBuiltin(klass) {
@constructor
@public
*/
export default class EmberError extends ExtendBuiltin(Error) {
constructor(message) {
super();

if (!(this instanceof EmberError)) {
return new EmberError(message);
}
export default class EmberError extends Error {
constructor(message, code) {
let error = super(message, code);

let error = Error.call(this, message);
this.stack = error.stack;
this.description = error.description;
this.fileName = error.fileName;
Expand Down

0 comments on commit b6ee5e0

Please sign in to comment.