further enhanced error handling + added retries in case of parallel writes
This commit is contained in:
@ -22,15 +22,7 @@ if (!empty($_GET['bundle'])) {
|
||||
echo json_encode($bundle, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
} catch (Throwable $e) {
|
||||
if (isset($tmpDb, $lockFp)) {
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
}
|
||||
if (function_exists('qdb_api_log_note_exception')) {
|
||||
qdb_api_log_note_exception($e);
|
||||
}
|
||||
require_once __DIR__ . '/../lib/errors.php';
|
||||
error_log('export bundle: ' . $e->getMessage());
|
||||
json_error('SERVER_ERROR', qdb_public_error_message($e, 'Export'), 500);
|
||||
qdb_handler_fail($e, 'Export questionnaires bundle', null, $tmpDb ?? null, $lockFp ?? null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,15 +45,7 @@ if (!empty($_GET['exportAll'])) {
|
||||
@unlink($zipPath);
|
||||
exit;
|
||||
} catch (Throwable $e) {
|
||||
if (isset($tmpDb, $lockFp)) {
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
}
|
||||
if (function_exists('qdb_api_log_note_exception')) {
|
||||
qdb_api_log_note_exception($e);
|
||||
}
|
||||
require_once __DIR__ . '/../lib/errors.php';
|
||||
error_log('export exportAll: ' . $e->getMessage());
|
||||
json_error('SERVER_ERROR', qdb_public_error_message($e, 'Export'), 500);
|
||||
qdb_handler_fail($e, 'Export responses ZIP', null, $tmpDb ?? null, $lockFp ?? null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,13 +96,5 @@ $filename = $safeName . '_v' . $questionnaire['version'] . '.csv';
|
||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||
echo qdb_export_rows_to_csv_string($rows, qdb_export_current_csv_fallback_header($resultColumns));
|
||||
} catch (Throwable $e) {
|
||||
if (isset($tmpDb, $lockFp)) {
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
}
|
||||
if (function_exists('qdb_api_log_note_exception')) {
|
||||
qdb_api_log_note_exception($e);
|
||||
}
|
||||
require_once __DIR__ . '/../lib/errors.php';
|
||||
error_log('export csv: ' . $e->getMessage());
|
||||
json_error('SERVER_ERROR', qdb_public_error_message($e, 'Export'), 500);
|
||||
qdb_handler_fail($e, 'Export CSV', null, $tmpDb ?? null, $lockFp ?? null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user