mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
[Crate] Add rich error type (#80)
* Add rich error type with source and backtrace
Adds a rich error type that will take a backtrace and allow capturing
the source of the error. The best way to use this is with the included
helpers that will automatically capture the backtrace and convert the
source error:
```
GDRichError::packet_bad_from_into("Reason packet was bad")
```
* [Crate] Bump MSRV to 1.65.0
This is required for backtraces in rich errors.
* Remove leftover debug logging
* [Errors] Replace variant overloads with single .rich method on kind enum
This overhaul replaces the exhaustive impls of each variant as multiple
methods on the rich error type with a singular .rich() method on the
kind enum. This consumes the variant and converts it to a rich error
with a source (.into() can be used if a source is not needed).
I also took the liberty of replacing all usages with the this new method
as I saw fit (adding various error messages) and converting a few
PacketBad errors to TypeParse errors when they are the result of parse
failing.
* Fix problem with rustdoc
* Remove BadGame's owned string
* Rename GDError to GDErrorKind
* Rename GDRichError to GDError
* Remove error impl from GDErrorKind
* Fix tests not passing
* Use error context everywhere map_err is used
* Improve GDError display formatter
* Add tests for new error type
This commit is contained in:
parent
f7b5463073
commit
5e7e010d24
30 changed files with 417 additions and 217 deletions
|
|
@ -11,7 +11,7 @@ within the library or want to request a feature, it's better to do so here rathe
|
|||
on Discord.
|
||||
|
||||
## Usage
|
||||
Minimum Supported Rust Version is `1.60.0` and the code is cross-platform.
|
||||
Minimum Supported Rust Version is `1.65.0` and the code is cross-platform.
|
||||
|
||||
Pick a game/service/protocol (check the [GAMES](GAMES.md), [SERVICES](SERVICES.md) and [PROTOCOLS](PROTOCOLS.md) files to see the currently supported ones), provide the ip and the port (be aware that some game servers use a separate port for the info queries, the port can also be optional if the server is running the default ports) then query on it.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue