misc: option_parser: streamline #[source] and Error

This streamlines the code base to follow best practices for
error handling in Rust: Each error struct implements
std::error::Error (most due via thiserror::Error derive macro)
and sets its source accordingly.

This allows future work that nicely prints the error chains,
for example.

So far, the convention is that each error prints its
sub error as part of its Display::fmt() impl.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-05-19 09:45:28 +02:00
committed by Rob Bradford
parent 262984f8fc
commit 0e40a50407
3 changed files with 14 additions and 16 deletions

3
Cargo.lock generated
View File

@@ -1435,6 +1435,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "option_parser"
version = "0.1.0"
dependencies = [
"thiserror 2.0.6",
]
[[package]]
name = "ordered-stream"