Implement a promise_rejects function to match assert_throws.