(error, node)
| 207 | } |
| 208 | |
| 209 | handleError(error, node) { |
| 210 | let plugin = this.result.lastPlugin |
| 211 | try { |
| 212 | if (node) node.addToError(error) |
| 213 | this.error = error |
| 214 | if (error.name === 'CssSyntaxError' && !error.plugin) { |
| 215 | error.plugin = plugin.postcssPlugin |
| 216 | error.setMessage() |
| 217 | } else if (plugin.postcssVersion) { |
| 218 | if (process.env.NODE_ENV !== 'production') { |
| 219 | let pluginName = plugin.postcssPlugin |
| 220 | let pluginVer = plugin.postcssVersion |
| 221 | let runtimeVer = this.result.processor.version |
| 222 | let a = pluginVer.split('.') |
| 223 | let b = runtimeVer.split('.') |
| 224 | |
| 225 | if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { |
| 226 | // eslint-disable-next-line no-console |
| 227 | console.error( |
| 228 | 'Unknown error from PostCSS plugin. Your current PostCSS ' + |
| 229 | 'version is ' + |
| 230 | runtimeVer + |
| 231 | ', but ' + |
| 232 | pluginName + |
| 233 | ' uses ' + |
| 234 | pluginVer + |
| 235 | '. Perhaps this is the source of the error below.' |
| 236 | ) |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } catch (err) { |
| 241 | /* c8 ignore next 3 */ |
| 242 | // eslint-disable-next-line no-console |
| 243 | if (console && console.error) console.error(err) |
| 244 | } |
| 245 | return error |
| 246 | } |
| 247 | |
| 248 | prepareVisitors() { |
| 249 | this.listeners = {} |
no test coverage detected