Hook phantom.onError in the bootstrap script

If an unhandled error occurs, the bootstrap script emits an error event and
exits with a non-zero exit code. Partial progress toward #4.