Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


TypeError thrown at undefined values #54

smirea opened this Issue · 2 comments

2 participants


If u pass in an undefined value, it is not caught by absurd. It would be nice if absurd would tell you where the error happen by throwing its own or notify you in some other way that you probably did something wrong :)


return {
  body: { width: undefined, }

Error: (no mentioned of where in the file it happened... :( )

Running "absurd:cssmin" (absurd) task
Error: '/Users/mozilla/Dropbox/www/nybl/kiwi/src/absurd/CommentBox.css.js'. [TypeError: Cannot call method 'toString' of undefined] TypeError: Cannot call method 'toString' of undefined
    at Object.add (/Users/mozilla/Dropbox/www/nybl/kiwi/node_modules/grunt-absurd/node_modules/absurd/lib/api/add.js:168:16)
    at Object.add (/Users/mozilla/Dropbox/www/nybl/kiwi/node_modules/grunt-absurd/node_modules/absurd/lib/API.js:117:16)
    at module.exports (/Users/mozilla/Dropbox/www/nybl/kiwi/src/absurd/CommentBox.css.js:39:7)
    at importFile (/Users/mozilla/Dropbox/www/nybl/kiwi/node_modules/grunt-absurd/node_modules/absurd/lib/api/import.js:37:26)
    at Object.<anonymous> (/Users/mozilla/Dropbox/www/nybl/kiwi/node_modules/grunt-absurd/node_modules/absurd/lib/api/import.js:47:4)
    at Object.import (/Users/mozilla/Dropbox/www/nybl/kiwi/node_modules/grunt-absurd/node_modules/absurd/lib/API.js:117:16)
    at /Users/mozilla/Dropbox/www/nybl/kiwi/src/absurd/absurd.js:16:15
    at (native)
    at module.exports (/Users/mozilla/Dropbox/www/nybl/kiwi/src/absurd/absurd.js:15:11)
    at importFile (/Users/mozilla/Dropbox/www/nybl/kiwi/node_modules/grunt-absurd/node_modules/absurd/lib/api/import.js:37:26)

I admit that absurd has a problem the error reporting as well as with the usage of the compiled file into the browser. It is a little bit difficult to find out where the style is defined. Especially if you use combineSelectors: true. Let's keep this issue open and I'll think about putting try-catch blocks here and there to see what is the effect.

@krasimir krasimir referenced this issue from a commit
@krasimir Resolving #54 e51e72e

I added a try-catch block in the add method. So now if you do:

    body: {
        width: undefined,
        padding: '20px'
}).compile(function(err, css) {
}, { minify: false });

You will get:

Error: Error adding: {"body":{"padding":"20px"}}

So, it tells you which object causes the problem.

test case here

@krasimir krasimir closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.