fromPlatformException static method
Maps a PlatformException from the native bridge to a typed ZSException.
Implementation
static ZSException fromPlatformException(PlatformException e) {
return switch (e.code) {
'not_configured' => ZSNotConfiguredException(e.message ?? 'SDK not configured'),
'cancelled' => ZSCancelledException(e.message ?? 'User cancelled'),
'product_not_found' => ZSProductNotFoundException(e.message ?? 'Product not found'),
'checkout_failed' => ZSCheckoutFailedException(e.message ?? 'Checkout failed'),
'api_error' => ZSApiException(e.message ?? 'API error'),
'user_id_required' => ZSUserIdRequiredException(e.message ?? 'User ID required'),
'web_checkout_disabled' => ZSWebCheckoutDisabledException(e.message ?? 'Web checkout disabled'),
_ => ZSApiException(e.message ?? 'Unknown error: ${e.code}'),
};
}