@@ -148,6 +148,19 @@ class SubscriptionRequired(TeslaFleetError): # Teslemetry specific
148148 status = 402
149149 key = "subscription_required"
150150
151+ class VehicleSubscriptionRequired (TeslaFleetError ): # Teslemetry specific
152+ """Subscription is required in order to use Teslemetry."""
153+
154+ message = "Vehicle data subscription is required to make this request."
155+ status = 402
156+ key = "vehicle_subscription_required"
157+
158+ class InsufficientCredits (TeslaFleetError ):
159+ """Account has insufficient credits to make this request."""
160+
161+ message = "Account has insufficient command credits to make this request."
162+ status = 402
163+ key = "insufficient_credits"
151164
152165class Forbidden (TeslaFleetError ):
153166 """Access to this resource is not authorized, developers should check required Scope."""
@@ -305,21 +318,6 @@ class UnknownFault(TeslaFleetInformationFault):
305318 message = "Unknown fault on signed command."
306319 code = 1
307320
308-
309- class NotOnWhitelistFault (TeslaFleetInformationFault ):
310- """Not on whitelist fault on signed command."""
311-
312- message = "Not on whitelist fault on signed command."
313- code = 2
314-
315-
316- class IVSmallerThanExpectedFault (TeslaFleetInformationFault ):
317- """IV smaller than expected fault on signed command."""
318-
319- message = "IV smaller than expected fault on signed command."
320- code = 3
321-
322-
323321class InvalidTokenFault (TeslaFleetInformationFault ):
324322 """Invalid token fault on signed command."""
325323
@@ -693,8 +691,13 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
693691 # This error does not return a body
694692 raise OAuthExpired ()
695693 elif resp .status == 402 :
696- if error == SubscriptionRequired .key :
697- raise SubscriptionRequired (data )
694+ for exception in [
695+ SubscriptionRequired ,
696+ VehicleSubscriptionRequired ,
697+ InsufficientCredits ,
698+ ]:
699+ if error == exception .key :
700+ raise exception (data )
698701 raise PaymentRequired (data )
699702 elif resp .status == 403 :
700703 if error == UnsupportedVehicle .key :
0 commit comments