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