repl: Use a domain to catch async errors safely

Fix #2031

Review, please: @TooTallNate