@@ -48,6 +48,7 @@ import com.owncloud.android.domain.exceptions.ServerConnectionTimeoutException
4848import com.owncloud.android.domain.exceptions.ServerNotReachableException
4949import com.owncloud.android.domain.exceptions.ServerResponseTimeoutException
5050import com.owncloud.android.domain.exceptions.ServiceUnavailableException
51+ import com.owncloud.android.domain.exceptions.SpecificForbiddenException
5152import com.owncloud.android.domain.exceptions.UnauthorizedException
5253import com.owncloud.android.domain.exceptions.validation.FileNameException
5354import java.util.Locale
@@ -61,18 +62,12 @@ fun Throwable.parseError(
6162 return this .message as String
6263 } else { // Build the error message otherwise
6364 val reason = when (this ) {
64- is NoConnectionWithServerException -> resources.getString(R .string.network_error_socket_exception)
65- is NoNetworkConnectionException -> resources.getString(R .string.error_no_network_connection)
66- is ServerResponseTimeoutException -> resources.getString(R .string.network_error_socket_timeout_exception)
67- is ServerConnectionTimeoutException -> resources.getString(R .string.network_error_connect_timeout_exception)
68- is ServerNotReachableException -> resources.getString(R .string.network_host_not_available)
69- is ServiceUnavailableException -> resources.getString(R .string.service_unavailable)
70- is ConflictException -> resources.getString(R .string.error_conflict)
71- is SSLRecoverablePeerUnverifiedException -> resources.getString(R .string.ssl_certificate_not_trusted)
65+ is AccountNotNewException -> resources.getString(R .string.auth_account_not_new)
66+ is AccountNotTheSameException -> resources.getString(R .string.auth_account_not_the_same)
7267 is BadOcVersionException -> resources.getString(R .string.auth_bad_oc_version_title)
73- is IncorrectAddressException -> resources.getString(R .string.auth_incorrect_address_title )
74- is SSLErrorException -> resources.getString(R .string.auth_ssl_general_error_title )
75- is UnauthorizedException -> resources.getString(R .string.auth_unauthorized )
68+ is ConflictException -> resources.getString(R .string.error_conflict )
69+ is CopyIntoDescendantException -> resources.getString(R .string.copy_file_invalid_into_descendent )
70+ is CopyIntoSameFolderException -> resources.getString(R .string.copy_file_invalid_overwrite )
7671 is FileAlreadyExistsException -> resources.getString(R .string.file_already_exists)
7772 is FileNameException -> {
7873 val stringId = when (this .type) {
@@ -82,21 +77,28 @@ fun Throwable.parseError(
8277 }
8378 resources.getString(stringId)
8479 }
80+ is FileNotFoundException -> resources.getString(R .string.common_not_found)
81+ is ForbiddenException -> resources.getString(R .string.uploads_view_upload_status_failed_permission_error)
82+ is IncorrectAddressException -> resources.getString(R .string.auth_incorrect_address_title)
83+ is InstanceNotConfiguredException -> resources.getString(R .string.auth_not_configured_title)
8584 is InvalidOverwriteException -> resources.getString(R .string.file_already_exists)
85+ is LocalFileNotFoundException -> resources.getString(R .string.local_file_not_found_toast)
8686 is MoveIntoDescendantException -> resources.getString(R .string.move_file_invalid_into_descendent)
87- is CopyIntoDescendantException -> resources.getString(R .string.copy_file_invalid_into_descendent)
8887 is MoveIntoSameFolderException -> resources.getString(R .string.move_file_invalid_overwrite)
89- is CopyIntoSameFolderException -> resources.getString(R .string.copy_file_invalid_overwrite)
90- is ForbiddenException -> resources.getString(R .string.forbidden_permissions, resources.getString(R .string.uploader_upload_forbidden_permissions))
91- is FileNotFoundException -> resources.getString(R .string.common_not_found)
92- is InstanceNotConfiguredException -> resources.getString(R .string.auth_not_configured_title)
93- is OAuth2ErrorException -> resources.getString(R .string.auth_oauth_error)
88+ is NoConnectionWithServerException -> resources.getString(R .string.network_error_socket_exception)
89+ is NoNetworkConnectionException -> resources.getString(R .string.error_no_network_connection)
9490 is OAuth2ErrorAccessDeniedException -> resources.getString(R .string.auth_oauth_error_access_denied)
95- is AccountNotNewException -> resources.getString(R .string.auth_account_not_new)
96- is AccountNotTheSameException -> resources.getString(R .string.auth_account_not_the_same)
97- is RedirectToNonSecureException -> resources.getString(R .string.auth_redirect_non_secure_connection_title)
98- is LocalFileNotFoundException -> resources.getString(R .string.local_file_not_found_toast)
91+ is OAuth2ErrorException -> resources.getString(R .string.auth_oauth_error)
9992 is QuotaExceededException -> resources.getString(R .string.failed_upload_quota_exceeded_text)
93+ is RedirectToNonSecureException -> resources.getString(R .string.auth_redirect_non_secure_connection_title)
94+ is SSLErrorException -> resources.getString(R .string.auth_ssl_general_error_title)
95+ is SSLRecoverablePeerUnverifiedException -> resources.getString(R .string.ssl_certificate_not_trusted)
96+ is ServerConnectionTimeoutException -> resources.getString(R .string.network_error_connect_timeout_exception)
97+ is ServerNotReachableException -> resources.getString(R .string.network_host_not_available)
98+ is ServerResponseTimeoutException -> resources.getString(R .string.network_error_socket_timeout_exception)
99+ is ServiceUnavailableException -> resources.getString(R .string.service_unavailable)
100+ is SpecificForbiddenException -> resources.getString(R .string.uploads_view_upload_status_failed_permission_error)
101+ is UnauthorizedException -> resources.getString(R .string.auth_unauthorized)
100102 else -> resources.getString(R .string.common_error_unknown)
101103 }
102104
0 commit comments