Skip to content

Commit

Permalink
Use module debug functions in ember-routing-htmlbars package
Browse files Browse the repository at this point in the history
  • Loading branch information
mmun committed Aug 25, 2015
1 parent 6ac1f46 commit ac8fb15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/ember-routing-htmlbars/lib/helpers/query-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@submodule ember-routing-htmlbars
*/

import Ember from 'ember-metal/core'; // assert
import { assert } from 'ember-metal/debug';
import QueryParams from 'ember-routing/system/query_params';

/**
Expand All @@ -23,7 +23,7 @@ import QueryParams from 'ember-routing/system/query_params';
@public
*/
export function queryParamsHelper(params, hash) {
Ember.assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', params.length === 0);
assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', params.length === 0);

return QueryParams.create({
values: hash
Expand Down
14 changes: 8 additions & 6 deletions packages/ember-routing-htmlbars/lib/keywords/element-action.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember-metal/core'; // assert
import { assert } from 'ember-metal/debug';
import { uuid } from 'ember-metal/utils';
import run from 'ember-metal/run_loop';
import { readUnwrappedModel } from 'ember-views/streams/utils';
Expand All @@ -12,10 +12,12 @@ export default {

var actionName = read(params[0]);

Ember.assert('You specified a quoteless path to the {{action}} helper ' +
'which did not resolve to an action name (a string). ' +
'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).',
typeof actionName === 'string' || typeof actionName === 'function');
assert(
'You specified a quoteless path to the {{action}} helper ' +
'which did not resolve to an action name (a string). ' +
'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).',
typeof actionName === 'string' || typeof actionName === 'function'
);

var actionArgs = [];
for (var i = 1, l = params.length; i < l; i++) {
Expand Down Expand Up @@ -99,7 +101,7 @@ ActionHelper.registerAction = function({ actionId, node, eventName, preventDefau
if (target.send) {
target.send.apply(target, [actionName, ...actionArgs]);
} else {
Ember.assert(
assert(
'The action \'' + actionName + '\' did not exist on ' + target,
typeof target[actionName] === 'function'
);
Expand Down
12 changes: 6 additions & 6 deletions packages/ember-routing-htmlbars/lib/keywords/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@submodule ember-templates
*/

import Ember from 'ember-metal/core'; // assert
import { assert } from 'ember-metal/debug';
import { get } from 'ember-metal/property_get';
import EmptyObject from 'ember-metal/empty_object';
import EmberError from 'ember-metal/error';
Expand Down Expand Up @@ -91,7 +91,7 @@ export default {
setupState(prevState, env, scope, params, hash) {
var name = params[0];

Ember.assert(
assert(
'The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.',
typeof name === 'string'
);
Expand Down Expand Up @@ -130,14 +130,14 @@ export default {
//
var router = container.lookup('router:main');

Ember.assert(
assert(
'The second argument of {{render}} must be a path, e.g. {{render "post" post}}.',
params.length < 2 || isStream(params[1])
);

if (params.length === 1) {
// use the singleton controller
Ember.assert(
assert(
'You can only use the {{render}} helper once without a model object as ' +
'its second argument, as in {{render "post" post}}.',
!router || !router._lookupActiveComponentNode(name)
Expand All @@ -147,7 +147,7 @@ export default {
}

var templateName = 'template:' + name;
Ember.assert(
assert(
'You used `{{render \'' + name + '\'}}`, but \'' + name + '\' can not be ' +
'found as either a template or a view.',
container.registry.has('view:' + name) || container.registry.has(templateName) || !!template
Expand Down Expand Up @@ -175,7 +175,7 @@ export default {
controllerFullName = 'controller:' + controllerName;
delete hash.controller;

Ember.assert(
assert(
'The controller name you supplied \'' + controllerName + '\' ' +
'did not resolve to a controller.',
container.registry.has(controllerFullName)
Expand Down

0 comments on commit ac8fb15

Please sign in to comment.