Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(functions.py): changed error catching checks to be for dictionari… #74

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions dtcli/src/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ def ps(
r = requests.get(url)
logger.debug(f"Status: {r.status_code}.")
policy_response = utilities.decode_response(r)
if "object has no attribute" in policy_response and isinstance(
files_response, str
if ("object has no attribute" in policy_response) and (
"error" in files_response
):
raise Exception(f"Could not find {dataset} {scope} in Datatrail.")
elif isinstance(files_response, str):
return None, policy_response
raise Exception(files_response["error"])
elif "error" in files_response:
return None, policy_response # type: ignore
return files_response, policy_response # type: ignore

except requests.exceptions.ConnectionError as e:
Expand Down Expand Up @@ -219,8 +219,8 @@ def find_missing_dataset_files(

# find dataset
dataset_locations = get_dataset_file_info(scope, dataset, verbose=verbose)
if isinstance(dataset_locations, str):
print(f"Could not find the dataset: {scope}, {dataset}")
if "error" in dataset_locations:
print(dataset_locations["error"])
return {}

# check for local copy of the data.
Expand Down
Loading