mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 15:51:12 -05:00
Fix: Implement pipeline error handling
Implement comprehensive error handling and robustness measures across the entire pipeline as per the detailed plan. This includes database-level security, client-side validation, scheduled maintenance, and fallback mechanisms for edge function failures.
This commit is contained in:
@@ -411,6 +411,39 @@ async function submitCompositeCreation(
|
||||
}
|
||||
}
|
||||
|
||||
// CRITICAL: Validate all temp refs were properly resolved
|
||||
const validateTempRefs = () => {
|
||||
const errors: string[] = [];
|
||||
|
||||
if (uploadedPrimary.type === 'park') {
|
||||
if ('_temp_operator_ref' in primaryData && primaryData._temp_operator_ref === undefined) {
|
||||
errors.push('Invalid operator reference - dependency not found');
|
||||
}
|
||||
if ('_temp_property_owner_ref' in primaryData && primaryData._temp_property_owner_ref === undefined) {
|
||||
errors.push('Invalid property owner reference - dependency not found');
|
||||
}
|
||||
} else if (uploadedPrimary.type === 'ride') {
|
||||
if ('_temp_park_ref' in primaryData && primaryData._temp_park_ref === undefined) {
|
||||
errors.push('Invalid park reference - dependency not found');
|
||||
}
|
||||
if ('_temp_manufacturer_ref' in primaryData && primaryData._temp_manufacturer_ref === undefined) {
|
||||
errors.push('Invalid manufacturer reference - dependency not found');
|
||||
}
|
||||
if ('_temp_designer_ref' in primaryData && primaryData._temp_designer_ref === undefined) {
|
||||
errors.push('Invalid designer reference - dependency not found');
|
||||
}
|
||||
if ('_temp_ride_model_ref' in primaryData && primaryData._temp_ride_model_ref === undefined) {
|
||||
errors.push('Invalid ride model reference - dependency not found');
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new Error(`Temp reference validation failed: ${errors.join(', ')}`);
|
||||
}
|
||||
};
|
||||
|
||||
validateTempRefs();
|
||||
|
||||
submissionItems.push({
|
||||
item_type: uploadedPrimary.type,
|
||||
action_type: 'create' as const,
|
||||
|
||||
Reference in New Issue
Block a user