Skip to content

Commit

Permalink
FLUID-5807: Simplified implementation and browser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amb26 committed Nov 4, 2015
1 parent 8935f09 commit 3292dfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/framework/core/js/Fluid.js
Expand Up @@ -175,9 +175,7 @@ var fluid = fluid || fluid_2_0_0;
this.stack = togo.stack;
return this;
};
var ErrorInheritor = function () {};
ErrorInheritor.prototype = Error.prototype;
fluid.FluidError.prototype = new ErrorInheritor();
fluid.FluidError.prototype = Object.create(Error.prototype);

// The framework's built-in "log" failure handler - this logs the supplied message as well as any framework activity in progress via fluid.log
fluid.logFailure = function (args, activity) {
Expand Down
9 changes: 9 additions & 0 deletions tests/framework-tests/core/js/FluidJSTests.js
Expand Up @@ -423,6 +423,15 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
}, "thingit");
fluid.pushSoftFailure(-1);
});

jqUnit.test("FLUID-5807 tests - identify fluid.FluidError", function () {
// These tests have a direct analogue in basic-node-tests.js
var error = new fluid.FluidError("thing");
jqUnit.assertTrue("Framework error is an error (from its own perspective)", error instanceof fluid.Error);
jqUnit.assertTrue("Framework error is an instance of itself", error instanceof fluid.FluidError);
var stack = error.stack.toString();
jqUnit.assertTrue("Our own filename must appear in the stack", stack.indexOf("FluidJSTests") !== -1);
});

function passTestLog(level, expected) {
jqUnit.assertEquals("Should " + (expected ? "not " : "") + "pass debug level " + level, expected, fluid.passLogLevel(fluid.logLevel[level]));
Expand Down

0 comments on commit 3292dfc

Please sign in to comment.