File tree 2 files changed +8
-3
lines changed
services/api-server/src/simcore_service_api_server
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 15
15
from models_library .api_schemas_webserver .wallets import WalletGetWithAvailableCredits
16
16
from models_library .projects_nodes_io import BaseFileLink
17
17
from models_library .users import UserID
18
+ from models_library .wallets import ZERO_CREDITS
18
19
from pydantic import NonNegativeInt
19
20
from pydantic .types import PositiveInt
20
21
from servicelib .fastapi .requests_decorators import cancel_on_disconnect
@@ -232,8 +233,11 @@ async def get_job_outputs(
232
233
if wallet is None :
233
234
raise MissingWalletError (job_id = project .uuid )
234
235
wallet_with_credits = await webserver_api .get_wallet (wallet_id = wallet .wallet_id )
235
- if wallet_with_credits .available_credits < 0.0 :
236
- raise InsufficientCreditsError (wallet_name = wallet_with_credits .name )
236
+ if wallet_with_credits .available_credits <= ZERO_CREDITS :
237
+ raise InsufficientCreditsError (
238
+ wallet_name = wallet_with_credits .name ,
239
+ wallet_credit_amount = wallet_with_credits .available_credits ,
240
+ )
237
241
238
242
outputs : dict [str , ResultsTypes ] = await get_solver_output_results (
239
243
user_id = user_id ,
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ class CustomBaseError(ApiServerBaseError):
6
6
7
7
8
8
class InsufficientCreditsError (CustomBaseError ):
9
- msg_template = "Wallet '{wallet_name}' does not have any credits. Please add some before requesting solver ouputs"
9
+ # NOTE: Same message as WalletNotEnoughCreditsError
10
+ msg_template = "Wallet '{wallet_name}' has {wallet_credit_amount} credits. Please add some before requesting solver ouputs"
10
11
11
12
12
13
class MissingWalletError (CustomBaseError ):
You can’t perform that action at this time.
0 commit comments