assert (desc, test) public
Define an assertion that will throw an exception if the condition is not met.
- In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from the ember.prod.js build.
// Test for truthiness Ember.assert('Must pass a valid object', obj); // Fail unconditionally Ember.assert('This code path should never be run');
Parameters:
-
desc
String
- A description of the assertion. This will become the text of the Error thrown if the assertion fails.
-
test
Boolean
- Must be truthy for the assertion to pass. If falsy, an exception will be thrown.
Please login to continue.