starknet-devnet icon indicating copy to clipboard operation
starknet-devnet copied to clipboard

Refactor errors

Open marioiordanov opened this issue 2 years ago • 9 comments

use starknet-rs generated errors

marioiordanov avatar Aug 15 '23 06:08 marioiordanov

Please kindly assign this task to me. Thanks

vibenedict avatar Apr 20 '24 18:04 vibenedict

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

PabloVillaplana avatar Apr 22 '24 05:04 PabloVillaplana

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.

vibenedict avatar Apr 22 '24 06:04 vibenedict

~~@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!

ivpavici avatar Apr 22 '24 09:04 ivpavici

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

PabloVillaplana avatar Apr 22 '24 15:04 PabloVillaplana

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!

ivpavici avatar Apr 23 '24 07:04 ivpavici

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 avatar Apr 29 '24 16:04 PabloVillaplana

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

PabloVillaplana avatar Aug 28 '24 02:08 PabloVillaplana

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<some_action>: StarknetDevnetError::NoStateAtBlock => ApiError::BlockNotFound

marioiordanov avatar Oct 18 '24 07:10 marioiordanov

Not relevant anymore

marioiordanov avatar May 05 '25 06:05 marioiordanov