Return simple types and errors from JavaScript code