Test both throwing and returning an error in the callback