added timeout support for queries
passing statusCode in error