@@ -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