Sha256: 0acf564171ea511bb5c274b914c85fd66e7ef3427b46dd871de28ac63249b916

Contents?: true

Size: 1.28 KB

Versions: 23

Compression:

Stored size: 1.28 KB

Contents

## Error Reporting

 Stylus has fantastic error reporting built in for syntax, parse, and evaluation errors, complete with stack traces, line numbers, and filenames.

### Parse Error

Parse error example:

     body
       form input
         == padding 5px

yielding:

     Error: /Users/tj/Projects/stylus/testing/test.styl:4
       3: '  form input'
       4: '    == padding 5px'

     illegal unary ==

### Evaluation Error

 This "runtime" or evaluation error is caused due to passing a string to `border-radius()` instead of the expected `Unit` by using our helper `ensure(n, 'unit')`.

      ensure(val, type)
        unless val is a type
          error('expected a ' + type + ', but got ' + typeof(val))

      border-radius(n)
        ensure(n, 'unit')
        -webkit-border-radius n
        -moz-border-radius n
        border-radius n

      body
        border-radius '5px'

yielding:

      Error: /Users/tj/Projects/stylus/examples/error.styl:12
        11: ''
        12: 'body'
        13: '  border-radius \'5px\''
        14: ''

      expected a unit, but got string
          at ensure() (/Users/tj/Projects/stylus/examples/error.styl:2)
          at border-radius() (/Users/tj/Projects/stylus/examples/error.styl:5)
          at "body" (/Users/tj/Projects/stylus/examples/error.styl:10)

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
stylus-source-0.22.6 vendor/docs/error-reporting.md
stylus-source-0.22.5 vendor/docs/error-reporting.md
stylus-source-0.22.4 vendor/docs/error-reporting.md
stylus-source-0.22.3 vendor/docs/error-reporting.md
stylus-source-0.22.2 vendor/docs/error-reporting.md
stylus-source-0.22.1 vendor/docs/error-reporting.md
stylus-source-0.22.0 vendor/docs/error-reporting.md
stylus-source-0.21.2 vendor/docs/error-reporting.md
stylus-source-0.21.1 vendor/docs/error-reporting.md
stylus-source-0.21.0 vendor/docs/error-reporting.md
stylus-source-0.20.1 vendor/docs/error-reporting.md
stylus-source-0.20.0 vendor/docs/error-reporting.md
stylus-source-0.19.8 vendor/docs/error-reporting.md
stylus-source-0.19.7 vendor/docs/error-reporting.md
stylus-source-0.19.6 vendor/docs/error-reporting.md
stylus-source-0.19.5 vendor/docs/error-reporting.md
stylus-source-0.19.4 vendor/docs/error-reporting.md
stylus-source-0.19.3 vendor/docs/error-reporting.md
stylus-source-0.19.2 vendor/docs/error-reporting.md
stylus-source-0.19.1 vendor/docs/error-reporting.md