update onerror to provide stack trace