better error handling for listing resources