onerror: check existence of error
Merge pull request #61 from jonathanong/onerror-condition

onerror: check existence of error