Comments (9)
So I think we should go with the solution you suggested 🙂, What are your thoughts
Okay, I will implement this solution 🚀 🙂
from websurfx.
@xffxff as we had discussed this issue earlier, would you like to work on this issue?? 🙂
from websurfx.
Yes, I would be willing to work on this issue. @neon-mmd
from websurfx.
I have found that it is not possible to convert scraper::error::SelectorErrorKind
to Report
because Report
requires the error to be Sync
and Send
. Unfortunately, scraper::error::SelectorErrorKind
is not thread-safe, and therefore the following code is invalid:
let no_result: Selector = Selector::parse(".no-results").into_report()?;
from websurfx.
I have found that it is not possible to convert
scraper::error::SelectorErrorKind
toReport
becauseReport
requires the error to beSync
andSend
. Unfortunately,scraper::error::SelectorErrorKind
is not thread-safe, and therefore the following code is invalid:let no_result: Selector = Selector::parse(".no-results").into_report()?;
This seems interesting 🙂, Is there any other way to fix this if possible ?? or any other possible solutions?? 🙂 .
from websurfx.
@neon-mmd I think one solution is to avoid converting scraper::error::SelectorErrorKind
to Report
. Instead, we can create a Report
with UnexpectedError
let no_result: Selector = Selector::parse(".no-results")
.map_err(|_| Report::new(EngineError::UnexpectedError))
.attach_printable_lazy(|| format!("invalid CSS selector: {}", ".no-results"))?;
However, by doing this, we lose the information about the lower-level source of UnexpectedError
, which in this case is scraper::error::SelectorErrorKind
. This is not equivalent to our current implementation:
pub enum EngineErrorKind {
RequestError(reqwest::Error),
EmptyResultSet,
UnexpectedError {
message: String,
source: Option<Box<dyn std::error::Error>>,
},
}
from websurfx.
@neon-mmd I think one solution is to avoid converting
scraper::error::SelectorErrorKind
toReport
. Instead, we can create aReport
withUnexpectedError
let no_result: Selector = Selector::parse(".no-results") .map_err(|_| Report::new(EngineError::UnexpectedError)) .attach_printable_lazy(|| format!("invalid CSS selector: {}", ".no-results"))?;However, by doing this, we lose the information about the lower-level source of
UnexpectedError
, which in this case isscraper::error::SelectorErrorKind
. This is not equivalent to our current implementation:pub enum EngineErrorKind { RequestError(reqwest::Error), EmptyResultSet, UnexpectedError { message: String, source: Option<Box<dyn std::error::Error>>, }, }
I think maybe we could try using the std
feature for error-stack, I feel it would solve the issue and if that doesn't work then we will go with this implementation you mentioned. what do you say @xffxff ?? 🙂
from websurfx.
I think maybe we could try using the
std
feature for error-stack, I feel it would solve the issue
@neon-mmd I think I have already used the std
feature, as it is the default feature flag for error-stack
.
from websurfx.
I think maybe we could try using the
std
feature for error-stack, I feel it would solve the issue@neon-mmd I think I have already used the
std
feature, as it is the default feature flag forerror-stack
.
My bad 😄, I think I didn't read this part because the docs say it is built mostly on no-std
and the features section
mentioned the std
feature explicitly, So now we have only one option to forth we would need to make tradeoff making the selector-error less informative while making others more informative and I think this tradeoff won't be that bad I feel because it would make most of the errors more informative than the current implementation which doesn't offer that much information on errors. So I think we should go with the solution you suggested 🙂, What are your thoughts @xffxff ??
from websurfx.
Related Issues (20)
- 📱 Redesign the `simple` theme to make it responsive to screen size changes HOT 1
- 🧑💻 Install `cargo-watch` via the `nix develop` command HOT 3
- 🐛 `Cargo test` failure when developing work on the app using `nix develop` due to missing `openssl` package HOT 3
- 💫 More `animations` for the search engine website HOT 1
- 💄 Replace the search button with a magnifying glass HOT 3
- 📝 NixOS development environment setup HOT 3
- :bug: Explicit `Content-Type` header for HTTP response HOT 3
- :recycle: The page number for upstream search queries should start at 0 HOT 3
- :zap: Compression for the page responses of the search engine HOT 1
- :children_crossing: Display the user provided settings from the config or the UI in the settings page HOT 1
- 🐛 Results from different search engines get cached as the same key HOT 4
- :recycle: Standardize the `content-type` header by using an enum value over typing it manually HOT 5
- 🐛 Pagination for the upstream search engines not working HOT 1
- 🐛 `Librex` engine only returns one result on the search page HOT 1
- 🐛 Minification of javascript files fails while running the build command HOT 1
- :recycle: `Json` api support for the upstream search engines HOT 7
- :zap: Several optimizations for improving the performance of the engine HOT 2
- ✨ Categories tabs for different search content in the search page HOT 1
- 📝 Revise the `docs` to remain in sync with the current changes HOT 1
- 👷 Clippy/Format checking/linting GitHub action to analyze code for all the features HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websurfx.