Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upReturning `Result`s for a lot of rendering functions makes the api more complicated than needed. #512
Comments
expenses
changed the title
returning `Result`s for a lot of rendering functions makes the api more complicated than needed.
Returning `Result`s for a lot of rendering functions makes the api more complicated than needed.
Nov 14, 2018
This comment has been minimized.
This comment has been minimized.
|
I sympathize but disagree. It's a matter of opinion when to panic and when to return
|
icefoxen
added
the
question
label
Nov 14, 2018
This comment has been minimized.
This comment has been minimized.
|
Canonical response to things like this, in case the question ever comes up again: https://www.reddit.com/r/rust/comments/9x17hn/when_should_a_library_panic_vs_return_result/e9p5c9t
|
expenses commentedNov 14, 2018
Although some of these functions could fail (
set_colorcannot so I'm not sure why it returns aGameResult), I think it is generally better for game engines to just bite the bullet and panic if a buffer etc is unable to be created rather than let the user catch the error, especially if we're copying LÖVE.