add a test for handling errors in the onRequest handler