mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
fix(generate)!: hold IoError inside GenerateError::GrammarPath
This commit is contained in:
parent
cde84508ac
commit
baad4174e5
|
|
@ -76,7 +76,7 @@ pub type GenerateResult<T> = Result<T, GenerateError>;
|
|||
#[derive(Debug, Error, Serialize, Deserialize)]
|
||||
pub enum GenerateError {
|
||||
#[error("Error with specified path -- {0}")]
|
||||
GrammarPath(String),
|
||||
GrammarPath(IoError),
|
||||
#[error(transparent)]
|
||||
IO(IoError),
|
||||
#[cfg(feature = "load")]
|
||||
|
|
@ -347,7 +347,7 @@ where
|
|||
let path_buf: PathBuf = path.into();
|
||||
if !path_buf
|
||||
.try_exists()
|
||||
.map_err(|e| GenerateError::GrammarPath(e.to_string()))?
|
||||
.map_err(|e| GenerateError::GrammarPath(IoError::new(e, Some(&path_buf))))?
|
||||
{
|
||||
// A nonexistent path with an extension (i.e. tree-sitter-foo/grammar.json)
|
||||
// is a missing input file, not a directory to create.
|
||||
|
|
|
|||
Loading…
Reference in a new issue