Error handling
The Error module provides comprehensive error handling for GPX operations:
- XML parsing and validation errors
- Coordinate validation errors
- Missing required elements or attributes
- File I/O errors
Error types and exception handling for GPX operations
Sourcetype t = | Invalid_xml of stringXML parsing/structure error
| Invalid_coordinate of stringCoordinate validation error
| Missing_required_attribute of string * stringMissing XML attribute (element, attr)
| Missing_required_element of string| Validation_error of string| Xml_error of string| IO_error of string
Result type for operations that can fail
Error Operations
Convert error to human-readable string
Error Constructors
Sourceval invalid_xml : string -> t Sourceval invalid_coordinate : string -> t Create invalid coordinate error
Sourceval missing_attribute : string -> string -> t Create missing attribute error
Sourceval missing_element : string -> t Create missing element error
Sourceval validation_error : string -> t Result Helpers
Convert exception to result
Convert result to exception
Convert string result to error result
Error Classification
Check if error is XML-related
Sourceval is_coordinate_error : t -> bool Check if error is coordinate-related
Sourceval is_validation_error : t -> bool Check if error is validation-related
Check if error is IO-related