near / near-indexer-for-explorer

Watch NEAR network and store all the data from NEAR blockchain to PostgreSQL database
https://near-indexers.io/docs/projects/near-indexer-for-explorer
GNU General Public License v3.0
124 stars 56 forks source link

Improve error handling: introduce error types instead of passing String #143

Closed telezhnaya closed 3 years ago

telezhnaya commented 3 years ago

https://github.com/near/near-indexer-for-explorer/pull/136#discussion_r685919267

https://nick.groenen.me/posts/rust-error-handling/

frol commented 3 years ago

Also, let's refactor the aggregated modules system. One idea:

# src/main.rs
self::aggregations::run_in_background();

# src/aggregations/mod.rs
fn run_in_background() {
    tokio::spawn(self::circulating_supply::run_in_background());
}

# src/aggregations/circulating_supply/mod.rs
async fn run_in_background() {}