DCL

An elegant OOP with mixins + AOP for JavaScript.

dclDebug.SuperResultError

Version 1.x

dclDebug.SuperResultError is present only when dcl/debug is required. It is thrown when a method used for a supercall, or an around advice does not follow the double function pattern and returns something other than a function. It works for supercalls, and class-level and object-level advices.

Examples

Wrong result
1
2
3
4
5
6
7
8
9
10
11
var dcl = require("dcl"),
  dclDebug = require("dcl/debug");

var A = dcl(null, {
  declaredClass: "A",
  m: dcl.superCall(function(sup){
    return "Instead of a function I return a string.";
  })
});

// At this point dclError.SuperResultError will be thrown.

You will see the following exception:

1
dcl: around advice or supercall should return a function in: A, method: m