From e6b0ba994a27f02d106e12f5b9d568a87b9c22f6 Mon Sep 17 00:00:00 2001 From: Francesco Nazzaro Date: Fri, 14 Jun 2024 16:15:27 +0200 Subject: [PATCH] revert error type (#162) * revert error type * qa --- cads_adaptors/adaptors/mars.py | 3 +-- cads_adaptors/adaptors/multi.py | 4 ++-- cads_adaptors/constraints.py | 2 +- cads_adaptors/tools/url_tools.py | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cads_adaptors/adaptors/mars.py b/cads_adaptors/adaptors/mars.py index d3b51550..48dd2f10 100644 --- a/cads_adaptors/adaptors/mars.py +++ b/cads_adaptors/adaptors/mars.py @@ -1,7 +1,6 @@ import os from typing import Any, BinaryIO, Union -from cads_adaptors import exceptions from cads_adaptors.adaptors import Context, Request, cds from cads_adaptors.tools import adaptor_tools from cads_adaptors.tools.date_tools import implement_embargo @@ -127,7 +126,7 @@ def execute_mars( context.add_user_visible_error( message=error_message, ) - raise exceptions.InvalidRequest(error_message) + raise RuntimeError(error_message) return target diff --git a/cads_adaptors/adaptors/multi.py b/cads_adaptors/adaptors/multi.py index 59c8f85b..63ee128d 100644 --- a/cads_adaptors/adaptors/multi.py +++ b/cads_adaptors/adaptors/multi.py @@ -1,7 +1,7 @@ from copy import deepcopy from typing import Any -from cads_adaptors import AbstractCdsAdaptor, exceptions, mapping +from cads_adaptors import AbstractCdsAdaptor, mapping from cads_adaptors.adaptors import Request from cads_adaptors.tools.general import ensure_list @@ -108,7 +108,7 @@ def retrieve(self, request: Request): results += this_result if len(results) == 0: - raise exceptions.InvalidRequest( + raise RuntimeError( "MultiAdaptor returned no results, the error logs of the sub-adaptors is as follows:\n" f"{exception_logs}" ) diff --git a/cads_adaptors/constraints.py b/cads_adaptors/constraints.py index a6891246..3be2551e 100644 --- a/cads_adaptors/constraints.py +++ b/cads_adaptors/constraints.py @@ -688,7 +688,7 @@ def legacy_intersect_constraints( f" in the web-portal, your request:\n {request}\n" "If you believe this to be a data store error, please contact user support.\n" ) - raise exceptions.InvalidRequest( + raise RuntimeError( "Request has not produce a valid combination of values, please check your selection.\n" f"{request}" ) diff --git a/cads_adaptors/tools/url_tools.py b/cads_adaptors/tools/url_tools.py index 91e63fa7..704d41ab 100644 --- a/cads_adaptors/tools/url_tools.py +++ b/cads_adaptors/tools/url_tools.py @@ -11,7 +11,6 @@ import yaml from tqdm import tqdm -from cads_adaptors import exceptions from cads_adaptors.adaptors import Context from cads_adaptors.tools import hcube_tools @@ -65,7 +64,7 @@ def try_download(urls: List[str], context: Context, **kwargs) -> List[str]: "Your request has not found any data, please check your selection.\n" "If you believe this to be a data store error, please contact user support." ) - raise exceptions.InvalidRequest( + raise RuntimeError( f"Request empty. No data found from the following URLs:" f"\n{yaml.safe_dump(urls, indent=2)} " )