Conversation
provides both machine-readable error classification and human-readable detailed messages 1. Error Kind Constants (in types.rs) Added 11 error type constants that map to LabVIEW enums: - ERROR_KIND_NONE through ERROR_KIND_UNKNOWN 2. Enhanced Response Structure (in types.rs) Added three new fields to track error details: - error_kind: The type of error (timeout, connection, etc.) - error_url: The URL associated with the error - error_source: The root cause from the error chain 3. Error Analysis Function (in async_support.rs) Created analyze_reqwest_error() that: - Classifies errors using reqwest's is_*() methods - Extracts the URL if available - Gets the root cause via source() - Builds a detailed error message with the full error chain 4. New FFI Functions (in ffi/request.rs) - request_get_error_kind() - Returns the error type constant - request_get_error_message() - Returns the detailed error message - request_get_error_url() - Returns the URL if available - request_get_error_source() - Returns the root cause - request_response_has_error() - Checks if there's any error 5. Exports Updated (in lib.rs) All new functions are exported for use by LabVIEW Now when you get a timeout error, you'll be able to: 1. Call request_get_error_kind() and get ERROR_KIND_TIMEOUT (value 1) 2. Call request_get_error_message() to get a detailed message including the root cause 3. Call request_get_error_url() to see which URL failed 4. Call request_get_error_source() to get just the underlying error cause
…C strings instead of using provided buffers. Updated related tests to reflect changes in error handling functions.
…oftware/reqwest-rs-labview into error-handling-improvements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements significant error handling improvements for the reqwest-rs-labview library:
Core Changes:
- error_kind: Type of error (timeout, connection, etc.)
- error_url: URL associated with the error
- error_source: Root cause from error chain
- error_message: Detailed human-readable message
- get_error_kind.vi - Returns error type constant
- get_error_message.vi - Returns detailed error message
- get_error_url.vi - Returns associated URL
- get_error_source.vi - Returns root cause
- get_has_error.vi - Checks for any error
- raise_any_errors.vi - New error raising VI
- reqwest_error_kind_enum.ctl - Error kind enumeration control
- Removed get_has_transport_error.vi and get_transport_error.vi in favor of the new comprehensive error handling
The changes provide both machine-readable error classification for programmatic handling and human-readable detailed messages for debugging, making error handling in LabVIEW applications more robust and informative.
This enables raising very detailed error information, was well as allowing the user to check the type of error (like a timeout error) via the get_error_kind.vi method.
Fixes #38