DCL

An elegant OOP with mixins + AOP for JavaScript.

dclDebug.ChainingError

Version 1.x

dclDebug.ChainingError is present only when dcl/debug is required. It is thrown when dcl is used to mix bases with different chaining orders for the same method.

Examples

Conflicting chains
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var dcl = require("dcl"),
  dclDebug = require("dcl/debug");

var A = dcl(null, {
  declaredClass: "A"
});
dcl.chainAfter(A, "m");

var B = dcl(null, {
  declaredClass: "B"
});
dcl.chainBefore(B, "m");

var ChainConflict = dcl([A, B], {
  declaredClass: "ChainConflict"
});

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

You will see the following exception:

1
2
dcl: conflicting chain directives from bases found in: ChainConflict, method: m -
it was ERRONEOUSLY CHAINED BEFORE AND AFTER yet A sets it to CHAINED AFTER