Skip to content

Commit 378d3ae

Browse files
committed
cron/Workplace: move status check to MakeOperator()
1 parent 4b0a25a commit 378d3ae

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

debian/changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cm4all-workshop (6.10) unstable; urgency=low
22

3-
*
3+
* cron: check the translation status for HTTP jobs
44

55
--
66

src/cron/Workplace.cxx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ MakeSpawnOperator(EventLoop &event_loop, SpawnService &spawn_service,
177177
const CronJob &job, const char *command,
178178
const TranslateResponse &response)
179179
{
180+
assert(response.status == HttpStatus{});
181+
180182
/* prepare the child process */
181183

182184
FdHolder close_fds;
@@ -188,16 +190,6 @@ MakeSpawnOperator(EventLoop &event_loop, SpawnService &spawn_service,
188190
p.args.push_back(command);
189191
}
190192

191-
if (response.status != HttpStatus{}) {
192-
if (response.message != nullptr)
193-
throw FmtRuntimeError("Status {} from translation server: {}",
194-
static_cast<unsigned>(response.status),
195-
response.message);
196-
197-
throw FmtRuntimeError("Status {} from translation server",
198-
static_cast<unsigned>(response.status));
199-
}
200-
201193
if (response.child_options.uid_gid.IsEmpty() && !debug_mode)
202194
throw std::runtime_error("No UID_GID from translation server");
203195

@@ -268,6 +260,16 @@ CronWorkplace::Running::MakeOperator(SocketAddress translation_socket,
268260
std::throw_with_nested(std::runtime_error("Translation failed"));
269261
}
270262

263+
if (response.status != HttpStatus{}) {
264+
if (response.message != nullptr)
265+
throw FmtRuntimeError("Status {} from translation server: {}",
266+
static_cast<unsigned>(response.status),
267+
response.message);
268+
269+
throw FmtRuntimeError("Status {} from translation server",
270+
static_cast<unsigned>(response.status));
271+
}
272+
271273
if (response.site != nullptr)
272274
site = response.site;
273275

0 commit comments

Comments
 (0)