Skip to content

Conversation

@ptpt
Copy link
Member

@ptpt ptpt commented Aug 6, 2025

This pull request introduces several improvements to error handling, logging, and user feedback throughout the Mapillary tools codebase, with a focus on making validation messages clearer and more user-friendly. It also refactors the handling of maximum capture speed and improves exception management for video processing. The most important changes are grouped below:

User Feedback and Logging Improvements:

  • Enhanced log messages to be more descriptive and user-friendly, including clearer progress messages (e.g., "==> Processing...", "==> Uploading...") and improved process summaries. [1] [2] [3] [4] [5]
  • Introduced the humanize library to present file sizes and time deltas in a more readable format in logs and error messages (e.g., "2.3 MB" instead of raw bytes, "3 hours ago" instead of a timestamp). [1] [2] [3] [4] [5] [6]

Error Handling and Exception Improvements:

  • Added a new MapillaryInvalidVideoError exception and improved error propagation for invalid or corrupt MP4 files by catching specific exceptions from both simple_mp4_parser and construct_mp4_parser. [1] [2] [3] [4] [5]
  • Improved error reporting for validation failures, including logging which files or sequences failed and why, and refactored error type handling to use exception types instead of string names for more robust processing. [1] [2] [3] [4] [5]

Capture Speed and Sequence Validation Refactor:

  • Refactored the maximum capture speed logic to use a MAX_CAPTURE_SPEED_KMH constant (in km/h) instead of MAX_AVG_SPEED (in m/s), and updated all related validation and error messages for clarity and consistency. [1] [2] [3] [4] [5] [6]
  • Improved validation functions to provide more detailed context in error messages, including the specific file or sequence involved. [1] [2] [3]

General Code Quality Improvements:

  • Replaced some generic exceptions (RuntimeError) with more specific ones (ValueError) for invalid metadata handling.
  • Minor code cleanups and restructuring for readability and maintainability. [1] [2] [3]

These changes together make the tool's output more understandable for users and developers, improve error diagnosis, and ensure more robust handling of edge cases during video and sequence processing.

@meta-cla meta-cla bot added the cla signed label Aug 6, 2025
@ptpt ptpt merged commit 2c14e95 into main Aug 6, 2025
16 checks passed
@ptpt ptpt deleted the chore-improve-error-messages branch August 6, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants