Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit fdae4ba

Browse files
Return a specific error when site is suspended
1 parent bd060e2 commit fdae4ba

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/site/SiteRestClient.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,12 @@ class SiteRestClient @Inject constructor(
720720

721721
return when (response) {
722722
is Error -> {
723-
val siteError = SiteError(INVALID_SITE)
724-
ConnectSiteInfoPayload(siteUrl, siteError)
723+
val siteErrorType = when (response.error.apiError) {
724+
"connection_disabled" -> SiteErrorType.WPCOM_SITE_SUSPENDED
725+
else -> INVALID_SITE
726+
}
727+
728+
ConnectSiteInfoPayload(siteUrl, SiteError(siteErrorType))
725729
}
726730
is Success -> {
727731
response.data.toConnectSiteInfoPayload(siteUrl)

fluxc/src/main/java/org/wordpress/android/fluxc/store/SiteStore.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,14 @@ open class SiteStore @Inject constructor(
896896
)
897897

898898
enum class SiteErrorType {
899-
INVALID_SITE, UNKNOWN_SITE, DUPLICATE_SITE, INVALID_RESPONSE, UNAUTHORIZED, NOT_AUTHENTICATED, GENERIC_ERROR
899+
INVALID_SITE,
900+
UNKNOWN_SITE,
901+
DUPLICATE_SITE,
902+
INVALID_RESPONSE,
903+
UNAUTHORIZED,
904+
NOT_AUTHENTICATED,
905+
GENERIC_ERROR,
906+
WPCOM_SITE_SUSPENDED
900907
}
901908

902909
enum class AllDomainsErrorType {

0 commit comments

Comments
 (0)