Reporting errors #1483

Closed
rstacruz opened this Issue Dec 25, 2015 · 4 comments

Projects

None yet

3 participants

@rstacruz

It seems like errors in tag expressions get silently discarded. Is there any way they can be seen?

In this case, it seems to silently fail:

riot.tag('my-tag', `
  <div attr="{nonexistent.foo()}">hi.</div>
`, function (opts) {})
riot.mount('*')

http://plnkr.co/edit/mDbZYZUTpjuQczGqVUeD?p=preview

@rstacruz

Errors in .on('update') are also silently discarded.

riot.tag('my-tag', '<div>hi</div>', function (opts) {
  this.on('update', function () {
    throw new Error('Notice me, senpai')
  })
})
riot.mount('*')

http://plnkr.co/edit/Fms25fQXqpDY13wJoSEp?p=preview

@rsbondi
Contributor
rsbondi commented Dec 25, 2015

for expression errors

riot.util.tmpl.errorHandler = function(e) {
  console.error('error handler', e)
}

for observable errors(tags are observables)

tag.on('error', function(e) {
    console.error('tag error', e)
})

http://plnkr.co/edit/ykqoJg?p=preview

@rstacruz

is there any way to make that happen globally for tag.on('error')?

@GianlucaGuarini
Member

@rstacruz this behavior will disappear in the next riot release so the errors in the observable will be always normally thrown..please hold on a couple of weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment