Tern error handling