Nutomic / ibis

GNU Affero General Public License v3.0
77 stars 5 forks source link

Proper error handling #16

Open Nutomic opened 7 months ago

Nutomic commented 7 months ago

The project currently uses unwrap all over the place, meaning it will crash if anything goes wrong. Need to get rid of this, add proper error handling and forbid unwrap usage via clippy.

Nutomic commented 7 months ago

https://github.com/Nutomic/ibis/commit/6dd1711e11fb628038a5f368327c52ae4041af41 cleanly handles all backend errors. Still lots of unwrap in the frontend.

Doomsdayrs commented 6 months ago

One of the biggest errors I see is related to #40

article_resource() unwraps the result, without care for the error.

Thus, the return type must be changed from Resource<Option<String>, ArticleView> to Resource<Option<String>, Result<ArticleView, Error>>

The problem with this is that all other views depend on the the resource being the first type.

This means every view must be modified to support the new result type.

The only issue is that ArticleNav depends on the first type.

Now honestly am stuck with my lack of rust knowledge.

Nutomic commented 6 months ago

Best open a pull request with the changes you have so far, that way I can have a look myself.