aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-04-12 11:56:21 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-04-12 11:56:21 +0100
commitc658ab440f8e69ac406b18732dbf276c084926b6 (patch)
treef033b38c6a16c6a900eb37f56ad9ae6f362cb435 /src/reader.rs
parent3d575ec2a4440e7e4597761eab907d63ef91175e (diff)
downloadpeanuts-c658ab440f8e69ac406b18732dbf276c084926b6.tar.gz
peanuts-c658ab440f8e69ac406b18732dbf276c084926b6.tar.bz2
peanuts-c658ab440f8e69ac406b18732dbf276c084926b6.zip
feat: include input in parse error
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs48
1 files changed, 36 insertions, 12 deletions
diff --git a/src/reader.rs b/src/reader.rs
index 93b28af..c4d85f7 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -107,8 +107,12 @@ where
self.read_buf().await?;
}
// TODO: better error
- Err::Error(e) => return Err(Error::ParseError(e.to_string())),
- Err::Failure(e) => return Err(Error::ParseError(e.to_string())),
+ Err::Error(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
+ Err::Failure(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
},
}
}
@@ -150,8 +154,12 @@ where
self.read_buf().await?;
}
// TODO: better error
- Err::Error(e) => return Err(Error::ParseError(e.to_string())),
- Err::Failure(e) => return Err(Error::ParseError(e.to_string())),
+ Err::Error(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
+ Err::Failure(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
},
}
}
@@ -184,8 +192,12 @@ where
self.read_buf().await?;
}
// TODO: better error
- Err::Error(e) => return Err(Error::ParseError(e.to_string())),
- Err::Failure(e) => return Err(Error::ParseError(e.to_string())),
+ Err::Error(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
+ Err::Failure(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
},
}
}
@@ -215,8 +227,12 @@ where
self.read_buf().await?;
}
// TODO: better error
- Err::Error(e) => return Err(Error::ParseError(e.to_string())),
- Err::Failure(e) => return Err(Error::ParseError(e.to_string())),
+ Err::Error(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
+ Err::Failure(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
},
}
}
@@ -300,8 +316,12 @@ where
self.read_buf().await?;
}
// TODO: better error
- Err::Error(e) => return Err(Error::ParseError(e.to_string())),
- Err::Failure(e) => return Err(Error::ParseError(e.to_string())),
+ Err::Error(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
+ Err::Failure(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
},
},
},
@@ -361,8 +381,12 @@ where
self.read_buf().await?;
}
// TODO: better error
- Err::Error(e) => return Err(Error::ParseError(e.to_string())),
- Err::Failure(e) => return Err(Error::ParseError(e.to_string())),
+ Err::Error(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
+ Err::Failure(e) => {
+ return Err(Error::ParseError(input.to_string(), e.to_string()))
+ }
},
}
}