mirror of
https://github.com/bitwarden/android.git
synced 2026-04-29 20:38:41 -05:00
PM-27770: Update error parsing when creating or updating a cipher (#6118)
This commit is contained in:
@@ -91,7 +91,10 @@ class CipherManagerImpl(
|
|||||||
.map { response ->
|
.map { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is CreateCipherResponseJson.Invalid -> {
|
is CreateCipherResponseJson.Invalid -> {
|
||||||
CreateCipherResult.Error(errorMessage = response.message, error = null)
|
CreateCipherResult.Error(
|
||||||
|
errorMessage = response.firstValidationErrorMessage,
|
||||||
|
error = null,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is CreateCipherResponseJson.Success -> {
|
is CreateCipherResponseJson.Success -> {
|
||||||
@@ -131,7 +134,10 @@ class CipherManagerImpl(
|
|||||||
.map { response ->
|
.map { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is CreateCipherResponseJson.Invalid -> {
|
is CreateCipherResponseJson.Invalid -> {
|
||||||
CreateCipherResult.Error(errorMessage = response.message, error = null)
|
CreateCipherResult.Error(
|
||||||
|
errorMessage = response.firstValidationErrorMessage,
|
||||||
|
error = null,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is CreateCipherResponseJson.Success -> {
|
is CreateCipherResponseJson.Success -> {
|
||||||
@@ -301,7 +307,10 @@ class CipherManagerImpl(
|
|||||||
.map { response ->
|
.map { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is UpdateCipherResponseJson.Invalid -> {
|
is UpdateCipherResponseJson.Invalid -> {
|
||||||
UpdateCipherResult.Error(errorMessage = response.message, error = null)
|
UpdateCipherResult.Error(
|
||||||
|
errorMessage = response.firstValidationErrorMessage,
|
||||||
|
error = null,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is UpdateCipherResponseJson.Success -> {
|
is UpdateCipherResponseJson.Success -> {
|
||||||
@@ -581,9 +590,7 @@ class CipherManagerImpl(
|
|||||||
.flatMap { response ->
|
.flatMap { response ->
|
||||||
when (response) {
|
when (response) {
|
||||||
is UpdateCipherResponseJson.Invalid -> {
|
is UpdateCipherResponseJson.Invalid -> {
|
||||||
IllegalStateException(
|
IllegalStateException(response.firstValidationErrorMessage)
|
||||||
response.message,
|
|
||||||
)
|
|
||||||
.asFailure()
|
.asFailure()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ sealed class CreateCipherResponseJson {
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class Invalid(
|
data class Invalid(
|
||||||
@SerialName("message")
|
@SerialName("message")
|
||||||
val message: String?,
|
override val message: String,
|
||||||
|
|
||||||
@SerialName("validationErrors")
|
@SerialName("validationErrors")
|
||||||
val validationErrors: Map<String, List<String>>?,
|
override val validationErrors: Map<String, List<String>>?,
|
||||||
) : CreateCipherResponseJson()
|
) : CreateCipherResponseJson(), InvalidJsonResponse
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ sealed class UpdateCipherResponseJson {
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class Invalid(
|
data class Invalid(
|
||||||
@SerialName("message")
|
@SerialName("message")
|
||||||
val message: String?,
|
override val message: String,
|
||||||
|
|
||||||
@SerialName("validationErrors")
|
@SerialName("validationErrors")
|
||||||
val validationErrors: Map<String, List<String>>?,
|
override val validationErrors: Map<String, List<String>>?,
|
||||||
) : UpdateCipherResponseJson()
|
) : UpdateCipherResponseJson(), InvalidJsonResponse
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user