mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: expose originalError from LiquidError, #742
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
import { TopLevelToken, TagToken, Tokenizer, Context, Liquid, Drop, toValueSync } from '../..'
|
||||
import { TopLevelToken, TagToken, Tokenizer, Context, Liquid, Drop, toValueSync, LiquidError } from '../..'
|
||||
const LiquidUMD = require('../../dist/liquid.browser.umd.js').Liquid
|
||||
|
||||
describe('Issues', function () {
|
||||
@@ -506,4 +506,13 @@ describe('Issues', function () {
|
||||
expect(liquid.parseAndRender('{{ 113 | uniq }}')).resolves.toEqual('113')
|
||||
expect(liquid.parseAndRender("{{ '113' | uniq }}")).resolves.toEqual('113')
|
||||
})
|
||||
it('Exposing originalError in LiquidError #742', () => {
|
||||
const engine = new Liquid()
|
||||
engine.registerFilter('error', () => { throw new Error('intended') })
|
||||
try {
|
||||
engine.parseAndRenderSync(`{{ "foo" | error }}`)
|
||||
} catch (err: unknown) {
|
||||
expect(LiquidError.is(err) && err.originalError).toHaveProperty('message', 'intended')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user