Java Code Examples for io.particle.android.sdk.cloud.exceptions.ParticleCloudException#getKind()
The following examples show how to use
io.particle.android.sdk.cloud.exceptions.ParticleCloudException#getKind() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateAccountActivity.java From particle-android with Apache License 2.0 | 5 votes |
private void signUpTaskFailure(@NonNull ParticleCloudException error) { log.d("onFailed()"); ParticleUi.showParticleButtonProgress(CreateAccountActivity.this, R.id.action_create_account, false); String msg = getString(R.string.create_account_unknown_error); if (error.getKind() == ParticleCloudException.Kind.NETWORK) { msg = getString(R.string.create_account_error_communicating_with_server); } else if (error.getResponseData() != null) { if (error.getResponseData().getHttpStatusCode() == 401 && (getResources().getBoolean(R.bool.organization) || getResources().getBoolean(R.bool.productMode))) { msg = getString(R.string.create_account_account_already_exists_for_email_address); } else { msg = error.getServerErrorMsg(); } } //TODO remove once sign up error code is fixed if (error.getCause() != null && error.getCause().getMessage().contains(emailView.getText().toString())) { msg = getString(R.string.create_account_account_already_exists_for_email_address); } Toaster.l(CreateAccountActivity.this, msg, Gravity.CENTER_VERTICAL); emailView.requestFocus(); }
Example 2
Source File: CreateAccountActivity.java From spark-setup-android with Apache License 2.0 | 5 votes |
private void signUpTaskFailure(@NonNull ParticleCloudException error) { // FIXME: look at old Spark app for what we do here UI & workflow-wise log.d("onFailed()"); ParticleUi.showParticleButtonProgress(CreateAccountActivity.this, R.id.action_create_account, false); String msg = getString(R.string.create_account_unknown_error); if (error.getKind() == ParticleCloudException.Kind.NETWORK) { msg = getString(R.string.create_account_error_communicating_with_server); } else if (error.getResponseData() != null) { if (error.getResponseData().getHttpStatusCode() == 401 && (getResources().getBoolean(R.bool.organization) || getResources().getBoolean(R.bool.productMode))) { msg = getString(R.string.create_account_account_already_exists_for_email_address); } else { msg = error.getServerErrorMsg(); } } //TODO remove once sign up error code is fixed if (error.getCause() != null && error.getCause().getMessage().contains(emailView.getText().toString())) { msg = getString(R.string.create_account_account_already_exists_for_email_address); } Toaster.l(CreateAccountActivity.this, msg, Gravity.CENTER_VERTICAL); emailView.requestFocus(); }