Skip to content

Commit 04aaf60

Browse files
raphaelmrobbi5
authored andcommitted
Detect error case with deleted check-in list (Z#23226056)
1 parent a706913 commit 04aaf60

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

libpretixsync/src/main/java/eu/pretix/libpretixsync/check/OnlineCheckProvider.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ class OnlineCheckProvider(
9393
res.type = TicketCheckProvider.CheckResult.Type.INVALID
9494
} else {
9595
val response = responseObj.data!!
96+
97+
if (responseObj.response.code == 400 && !response.has("status")) {
98+
if (response.has("lists")) {
99+
// Kind of a special case handling, but regular problem for users and just
100+
// passing through the error messages from the server is not generally helpful
101+
// since user's don't know what a primary key is etc
102+
throw CheckException("Check-in list not found")
103+
}
104+
}
105+
96106
val status = response.getString("status")
97107
if ("ok" == status) {
98108
res.type = TicketCheckProvider.CheckResult.Type.VALID

libpretixsync/src/main/java/eu/pretix/libpretixsync/check/ProxyCheckProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ class ProxyCheckProvider(private val config: ConfigStore, httpClientFactory: Htt
150150
e.printStackTrace()
151151
TicketCheckProvider.CheckResult(TicketCheckProvider.CheckResult.Type.ERROR, e.message)
152152
} catch (e: CheckException) {
153-
TicketCheckProvider.CheckResult(TicketCheckProvider.CheckResult.Type.ERROR, e.message)
153+
val r = TicketCheckProvider.CheckResult(TicketCheckProvider.CheckResult.Type.ERROR, e.message)
154+
r.reasonExplanation = e.message
155+
r
154156
}
155157
}
156158

0 commit comments

Comments
 (0)