File tree 4 files changed +7
-9
lines changed
services/api-server/src/simcore_service_api_server 4 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 10
10
from models_library .clusters import ClusterID
11
11
from pydantic .types import PositiveInt
12
12
13
+ from ...errors .http_error import create_error_json_response
13
14
from ...errors .services_exception_handlers import DEFAULT_BACKEND_SERVICE_STATUS_CODES
14
15
from ...models .basic_types import VersionStr
15
16
from ...models .schemas .errors import ErrorGet
33
34
from ..dependencies .authentication import get_current_user_id , get_product_name
34
35
from ..dependencies .services import get_api_client
35
36
from ..dependencies .webserver import AuthSession , get_webserver_session
36
- from ..errors .http_error import create_error_json_response
37
37
from ._common import API_SERVER_DEV_FEATURES_ENABLED
38
38
from ._jobs import start_project , stop_project
39
39
Original file line number Diff line number Diff line change @@ -232,12 +232,10 @@ async def get_job_outputs(
232
232
if product_price is not None :
233
233
wallet = await webserver_api .get_project_wallet (project_id = project .uuid )
234
234
if wallet is None :
235
- msg = f"Job { project .uuid } does not have an associated wallet."
236
- raise MissingWalletError (msg )
235
+ raise MissingWalletError (job_id = project .uuid )
237
236
wallet_with_credits = await webserver_api .get_wallet (wallet_id = wallet .wallet_id )
238
237
if wallet_with_credits .available_credits < 0.0 :
239
- msg = f"Wallet '{ wallet_with_credits .name } ' does not have any credits. Please add some before requesting solver ouputs"
240
- raise InsufficientCreditsError (msg )
238
+ raise InsufficientCreditsError (wallet_name = wallet_with_credits .name )
241
239
242
240
outputs : dict [str , ResultsTypes ] = await get_solver_output_results (
243
241
user_id = user_id ,
Original file line number Diff line number Diff line change 7
7
8
8
from ..core .settings import ApplicationSettings
9
9
from ..models .custom_errors import CustomBaseError
10
- from ..services . log_streaming import LogDistributionBaseException
10
+ from ..models . log_errors import LogDistributionBaseError
11
11
from ._custom_errors_handlers import custom_error_handler
12
12
from ._exception_handlers_factory import make_handler_for_exception
13
13
from ._http_exception_handlers import http_error_handler
@@ -25,7 +25,7 @@ def setup(app: FastAPI):
25
25
app .add_exception_handler (HTTPException , http_error_handler )
26
26
app .add_exception_handler (HttpxException , handle_httpx_client_exceptions )
27
27
app .add_exception_handler (RequestValidationError , http422_error_handler )
28
- app .add_exception_handler (LogDistributionBaseException , log_handling_error_handler )
28
+ app .add_exception_handler (LogDistributionBaseError , log_handling_error_handler )
29
29
app .add_exception_handler (CustomBaseError , custom_error_handler )
30
30
31
31
# SEE https://docs.python.org/3/library/exceptions.html#exception-hierarchy
Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ class CustomBaseError(ApiServerBaseError):
6
6
7
7
8
8
class InsufficientCreditsError (CustomBaseError ):
9
- pass
9
+ msg_template = "Wallet '{wallet_name}' does not have any credits. Please add some before requesting solver ouputs"
10
10
11
11
12
12
class MissingWalletError (CustomBaseError ):
13
- pass
13
+ msg_template = "Job {job_id} does not have an associated wallet."
14
14
15
15
16
16
class ApplicationSetupError (CustomBaseError ):
You can’t perform that action at this time.
0 commit comments