Skip to content

Commit 561224b

Browse files
chancedasmello
andauthored
Error docs and cleanup (#101)
* Renames `crate::resolve::ResolveError` to `crate::resolve::Error` * Adds type alias `crate::resolve::ResolveError` for `crate::resolve::Error` * Renames `crate::assign::AssignError` to `crate::assign::Error` * Adds type alias `crate::assign::AssignError` for crate::assign::Error` * Adds `position` (token index) to variants of `assign::Error` & `resolve::Error` --------- Co-authored-by: André Mello <[email protected]>
1 parent bf648a4 commit 561224b

File tree

10 files changed

+1369
-701
lines changed

10 files changed

+1369
-701
lines changed

CHANGELOG.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,52 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
98
## [Unreleased]
109

1110
### Added
1211

13-
- Adds method `into_buf` for `Box<Pointer>` and `impl From<PathBuf> for Box<Pointer>`.
12+
- Adds method `into_buf` for `Box<Pointer>` and `impl From<PathBuf> for Box<Pointer>`.
1413
- Adds unsafe associated methods `Pointer::new_unchecked` and `PointerBuf::new_unchecked` for
1514
external zero-cost construction.
1615
- Adds `Pointer::starts_with` and `Pointer::ends_with` for prefix and suffix matching.
1716
- Adds new `ParseIndexError` variant to express the presence non-digit characters in the token.
1817
- Adds `Token::is_next` for checking if a token represents the `-` character.
18+
- Adds `InvalidEncoding` to represent the two possible encoding errors when decoding a token.
19+
- Adds `diagnotic::Diagnostic` trait to facilitate error reporting and
20+
`miette` integration. All errors intended for usage with `assign::Assign` or
21+
`resolve::Resolve` must implement this trait.
22+
- Adds `diagnostic::Report<T>` to capture the input for `PointerBuf::parse`
23+
and to facilitate `miette` integration for all errors.
24+
- Adds `"miette"` feature flag to enable `miette` integration for error reporting.
1925

2026
### Changed
2127

22-
- Changed signature of `PathBuf::parse` to avoid requiring allocation.
23-
- Bumps minimum Rust version to 1.79.
2428
- `Pointer::get` now accepts ranges and can produce `Pointer` segments as output (similar to
2529
`slice::get`).
30+
- Bumps minimum Rust version to 1.79.
31+
- `PointerBuf::parse` now returns `RichParseError`, an alias to
32+
`Report<ParseError>` which contains the allocated string as well as the
33+
error. Use `Report::original` for matches or `Report::
34+
- Renames `ParseError::NoLeadingBackslash` to `ParseError::NoLeadingSlash`
35+
(sorry for the churn, I spaced hard - @chanced).
36+
- Adds field `position` to variants of `resolve::Error` and `assign::Error` to indicate the
37+
token index of where the error occurred.
38+
- Renames `ParseError::is_no_leading_backslash` to `ParseError::is_no_leading_slash`.
39+
- Renames `assign::AssignError` to `assign::Error`
40+
- Renames `resolve::ResolveError` to `resolve::Error`
41+
- Renames `InvalidEncodingError` to `EncodingError`
2642

2743
### Fixed
2844

2945
- Make validation of array indices conform to RFC 6901 in the presence of non-digit characters.
3046

47+
### Deprecated
48+
49+
- `ParseError::is_no_leading_backslash` renamed to `ParseError::is_no_leading_slash`.
50+
- `assign::AssignError` renamed to `assign::Error`
51+
- `resolve::ResolveError` renamed to `resolve::Error`
52+
- `InvalidEncodingError` renamed to `EncodingError`
53+
3154
## [0.6.2] 2024-09-30
3255

3356
### Added

0 commit comments

Comments
 (0)