-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse error falls back to Invalid (#1312)
# Description This PR makes it so that if at any point in the parsing of sbp messages the parsing fails, it has the option of falling back to an InvalidMessage which can then be written to the output. The way this PR acheives this goal is through some major breaking changes. The idea is that when errors are thrown throughout the process, we store all that local information in the constructed error. That way, choosing how to write the output can become as simple as matching on the thrown error and then basically writing `SbpMessage::from(error)`. This enables us to keep the previous behavior of skipping errors or returning on errors simply by refusing to handle the errors. `sbp2json`, `json2sbp` & `json2json` now have a new optional arg `--error_handler` which allows the following options `skip`, `return` or `ToInvalid`. that skip and return are the equivalent of the false and true passed to fatal-errors arg which as been removed. Care was taken to remove some panics in the parsing of SBP which could cause some types of invalid messages to be lost. Finally this PR does not do things like try to recover from being passed in malformed json or given an I/O error. In case of those error, if the `ToInvalid` option is passed, the code will panic. Some issues with this PR -- 1) it has a lot of breaking changes, and it kind of does a lot. Just want to make sure people like the direction i went in. 2) the lack of recovering from malformed json means I left json2json to panic if given ToInvalid as an option. 3) It has no unit tests. I wanted some eyes on this code and proposed solution before totally getting it over the finish line. # JIRA Reference https://swift-nav.atlassian.net/browse/DEVINFRA-1220 --------- Co-authored-by: Jason Mobarak <[email protected]> Co-authored-by: Patrick Crumley <[email protected]> Co-authored-by: Patrick Crumley <[email protected]> Co-authored-by: Jason Mobarak <[email protected]>
- Loading branch information
1 parent
ac9e865
commit 5f3909c
Showing
156 changed files
with
6,485 additions
and
4,241 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.