0xSpaceShard / starknet-devnet-rs

A local testnet for Starknet... in Rust
https://0xspaceshard.github.io/starknet-devnet-rs/
MIT License
106 stars 61 forks source link

Refactor errors #130

Open marioiordanov opened 1 year ago

marioiordanov commented 1 year ago

use starknet-rs generated errors

vibenedict commented 6 months ago

Please kindly assign this task to me. Thanks

PabloVillaplana commented 6 months ago

Hello @ivpavici @marioiordanov I would love to be part of this effort! 👷🏽‍♂️, thanks (I am in OD Hack telegram, ready to start on Monday 🫡)

vibenedict commented 6 months ago

I started learning Rust recently and I think this issue will give me a head start working with errors in Rust. In order to tackle this issue, I would scan through the codebase for anywhere errors are being used and replace it with starknet-rs generated errors.

ivpavici commented 6 months ago

~~@vibenedict please report frequently, if no progress si made during ~2 days we will assign @PabloVillaplana ~~

edit: ok, so we can have only one assignee per issue, so I switched up for this one!

PabloVillaplana commented 6 months ago

@marioiordanov @ivpavici @FabijanC Do we have more context or can we update the issue description a little? 🤔

ivpavici commented 6 months ago

hello! The issue means if we can potentially remove some error handling logic from our devnet code, and instead use the error handling logic from https://github.com/xJonathanLEI/starknet-rs Maybe it is not possible, so some investigation and testing is needed from your side!

PabloVillaplana commented 5 months ago

Hello

I was currently reviewing the starknet-rs library that uses thiserror, they do not handle as such an error handling that we can export in our code, at least I think so.

Could someone give me some light to continue investigating? 👀

PabloVillaplana commented 1 month ago

I am unassign me from this issue to give chance to another Dev

marioiordanov commented 2 days ago

StarknetDevnetError to ApiError is good candidate for refactoring too. Possible solution is to implement From trait for ApiError with the most common StarknetDevnetError -> ApiError mappings. If there are differences in some of the methods, mapping will be done in the method. For example in general: StarknetDevnetError::NoStateAtBlock => ApiError::NoStateAtBlock

but in starknet_devnet: StarknetDevnetError::NoStateAtBlock => ApiError::BlockNotFound