API: Proper error types instead of String #1424
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work in progress. I am also taking time to unify all error types, since there were many
SdlError
s before. I would like to discuss if compatibility is necessary, e.g. it could be a feature-flag that doestype SdlError = String;
See also: #1053
Summary:
OpenUrlError
,PrefPathError
,ShowMessageError
,WindowBuildError
andFontError
in favor ofError::InvalidString
common::IntegerOrSdlError
in favor ofError::IntOverflow
set_error_from_code
(internal SDL api, shouldn't be here? could add back asSdlErrorCode
)NulError
toError::InvalidString
?pref_path
checking for empty string instead of nullTODO:
TargetRenderError
,TextureValueError
,UpdateTextureError
,UpdateTextureYUVError
,AddMappingError
ttf::InitError
could be removed, if same ref-counting as subsystems is implemented for itttf::FontError
was removed, it might be good to review removingRendererableText
, as aCString
is always allocated anyway?String
->SdlError
, however this is messy becauseRWOps
should useError
, as it currently convertsio::Error
toString
, and that should be avoided