mirror of
https://github.com/openflocon/Flocon.git
synced 2026-04-30 07:20:03 +00:00
Feat badnetwork exeptions (#122)
* feat: [BADNETWORK] exceptions * added errors on okhttp * added errors on okhttp * feat: [BADNETWORK] exceptions * feat: [BADNETWORK] exceptions --------- Co-authored-by: Florent Champigny <florent@bere.al>
This commit is contained in:
parent
cae29db95c
commit
db3c8a118c
13 changed files with 491 additions and 191 deletions
|
|
@ -134,11 +134,21 @@ fun toRemote(domain: BadQualityConfigDomainModel): BadQualityConfigDataModel = B
|
|||
},
|
||||
errorProbability = domain.errorProbability,
|
||||
errors = domain.errors.map {
|
||||
BadQualityConfigDataModel.Error(
|
||||
weight = it.weight,
|
||||
errorCode = it.httpCode,
|
||||
errorBody = it.body,
|
||||
errorContentType = it.contentType,
|
||||
)
|
||||
when(val t = it.type) {
|
||||
is BadQualityConfigDomainModel.Error.Type.Body -> BadQualityConfigDataModel.Error(
|
||||
weight = it.weight,
|
||||
errorCode = t.httpCode,
|
||||
errorBody = t.body,
|
||||
errorContentType = t.contentType,
|
||||
errorException = null,
|
||||
)
|
||||
is BadQualityConfigDomainModel.Error.Type.Exception -> BadQualityConfigDataModel.Error(
|
||||
weight = it.weight,
|
||||
errorException = t.classPath,
|
||||
errorCode = null,
|
||||
errorBody = null,
|
||||
errorContentType = null,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ data class BadQualityConfigDataModel(
|
|||
@Serializable
|
||||
data class Error(
|
||||
val weight: Float, // increase the probability of being triggered vs all others errors
|
||||
val errorCode: Int,
|
||||
val errorBody: String,
|
||||
val errorContentType: String, // "application/json"
|
||||
val errorException: String?,
|
||||
val errorCode: Int?,
|
||||
val errorBody: String?,
|
||||
val errorContentType: String?, // "application/json"
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue