Skip to content

Commit

Permalink
Add source of the error (gnu like message)
Browse files Browse the repository at this point in the history
Close #3
  • Loading branch information
MoOx committed Oct 15, 2014
1 parent 73a139f commit 64a70eb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# 2.0.1 - 2014-08-10
# 2.1.0 - 2014-10-15

- Add source of the error (gnu like message) (fix [#3](https://github.com/postcss/postcss-calc/issues/3))

* Correctly ignore unrecognized values (fix [#2](https://github.com/postcss/postcss-calc/issues/2))
# 2.0.1 - 2014-08-10

- Correctly ignore unrecognized values (fix [#2](https://github.com/postcss/postcss-calc/issues/2))

# 2.0.0 - 2014-08-06

* Plugin now return a function to have a consistent api. ([ref 1](https://github.com/ianstormtaylor/rework-color-function/issues/6), [ref 2](https://twitter.com/jongleberry/status/496552790416576513))
- Plugin now return a function to have a consistent api. ([ref 1](https://github.com/ianstormtaylor/rework-color-function/issues/6), [ref 2](https://twitter.com/jongleberry/status/496552790416576513))

# 1.0.0 - 2014-08-04

Expand Down
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function plugin() {
dec.value = transform(dec.value)
}
catch (err) {
err.position = dec.position
err.message = gnuMessage(err.message, dec.source)
throw err
}
})
Expand All @@ -37,3 +37,13 @@ function transform(string) {

return reduceCSSCalc(string)
}

/**
* return GNU style message
*
* @param {String} message
* @param {Object} source
*/
function gnuMessage(message, source) {
return (source ? (source.file ? source.file : "<css input>") + ":" + source.start.line + ":" + source.start.column : "") + " " + message
}

0 comments on commit 64a70eb

Please sign in to comment.