Enhance the export_records.pl script with better error handling
and connection lifecycle management:
1. Connection Management:
- Always call disconnect() after file transport operations
- Ensure connections are cleaned up even on errors
2. Error Handling:
- Replace unusual die+pod2usage with clear error messages
- Add file existence validation before upload attempts
- Provide detailed error messages with context
- Consistent error message formatting
3. User Experience:
- Add validation for --delete_local_after_run without --destination_server_id
- Provide informative success messages to STDERR
- Better error messages with specific failure reasons
4. Robustness:
- Check if output file was created before upload
- Check if file exists before attempting deletion
- Graceful handling of missing upload directories
These improvements make the script more reliable and user-friendly
while maintaining all existing functionality.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>