MCPcopy
hub / github.com/postcss/postcss / parseError

Function parseError

test/css-syntax-error.test.ts:33–47  ·  view source on GitHub ↗
(
  css: string,
  opts?: Pick<ProcessOptions, 'from' | 'map'>
)

Source from the content-addressed store, hash-verified

31}
32
33function parseError(
34 css: string,
35 opts?: Pick<ProcessOptions, 'from' | 'map'>
36): CssSyntaxError {
37 try {
38 postcss.parse(css, opts)
39 } catch (e) {
40 if (isSyntaxError(e)) {
41 return e
42 } else {
43 throw e
44 }
45 }
46 throw new Error('Error was not thrown')
47}
48
49test('saves source', () => {
50 let error = parseError('a {\n content: "\n}')

Callers 1

Calls 2

isSyntaxErrorFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…