Skip to content

Improve error handling in engine_api client using thiserror. Fixes #326#338

Merged
banditopazzo merged 18 commits intoexein-io:mainfrom
zedddie:improve-errors
Apr 24, 2025
Merged

Improve error handling in engine_api client using thiserror. Fixes #326#338
banditopazzo merged 18 commits intoexein-io:mainfrom
zedddie:improve-errors

Conversation

@zedddie
Copy link
Copy Markdown
Contributor

@zedddie zedddie commented Apr 12, 2025

Improve engine_api errors

Improve errors in engine_api #326

(this is my second time trying to contribute, feedback is welcome)

  • run cargo fmt;
  • run cargo clippy;
  • run cargo testand all tests pass;
  • linked to the originating issue (if applicable).

@krsh krsh requested review from banditopazzo and vadorovsky April 14, 2025 11:57
@krsh krsh added the enhancement New feature or request label Apr 14, 2025
Copy link
Copy Markdown
Member

@banditopazzo banditopazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thank you for your PR! 👋

In general, it's fine. I pointed out some small things that would be great if you could address before merging. Let me know if anything is unclear or if you need a hand with it—happy to help!

Thanks again for your contribution! 😊

Comment thread crates/engine-api/src/client.rs Outdated
Comment thread crates/engine-api/src/client.rs Outdated
Comment thread crates/engine-api/src/client.rs Outdated
Comment thread crates/engine-api/src/client.rs Outdated
Comment thread crates/engine-api/src/client.rs Outdated
Comment thread crates/engine-api/src/client.rs Outdated
@zedddie
Copy link
Copy Markdown
Contributor Author

zedddie commented Apr 15, 2025

i hope i did requested changes well :p

Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
@zedddie
Copy link
Copy Markdown
Contributor Author

zedddie commented Apr 16, 2025

I removed everything you said, but have a problem, as I said earlier on line 260 events_stream is returning <Event, WebsocketError> so we cant convert Error to WebsocketError when there is no WebSocketConnectionError(which represent any WebsocketError (tokio_tungstenite::tungstenite::Error)) in our WebsocketError

@zedddie
Copy link
Copy Markdown
Contributor Author

zedddie commented Apr 16, 2025

to delete WebsocketConnectionError I will need to change fn event_monitor to return Result<Event, EngineClientError>>, EngineClientError> instead of Result<Event, WebsocketError>>, EngineClientError>, which seems to be strange, and will require to move all WebsocketError enums into EngineClientError

@banditopazzo
Copy link
Copy Markdown
Member

to delete WebsocketConnectionError I will need to change fn event_monitor to return Result<Event, EngineClientError>>, EngineClientError> instead of Result<Event, WebsocketError>>, EngineClientError>, which seems to be strange, and will require to move all WebsocketError enums into EngineClientError

right, never mind keep the code as it is

Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
Comment thread crates/engine-api/src/error.rs Outdated
@banditopazzo
Copy link
Copy Markdown
Member

please rebase also on main

@banditopazzo banditopazzo linked an issue Apr 24, 2025 that may be closed by this pull request
@banditopazzo banditopazzo merged commit 1f45744 into exein-io:main Apr 24, 2025
21 checks passed
@zedddie
Copy link
Copy Markdown
Contributor Author

zedddie commented Apr 28, 2025

thanks for your guidance 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

improve errors in engine_api module

3 participants