error handling using timeout