Closed Hermitter closed 4 years ago
I actually don't think this tool needs a global Error type.
Error
SInce the time you've made this, I made it the main thread's responsibility to exit if an error occurs: https://github.com/savoryink/setfont/blob/8f8db2ae2447b8321bfe81c75690eff381ecddb3/src/main.rs#L99-L101
I think instead of a global error, App::apply could return Result<(), Box<dyn std::error::Error>>, which then gets reported where it returns: https://github.com/savoryink/setfont/blob/8f8db2ae2447b8321bfe81c75690eff381ecddb3/src/main.rs#L93-L95
App::apply
Result<(), Box<dyn std::error::Error>>
If we're doing that approach, then did_error doesn't need to belong in Shared and instead can be updated to false where the error gets reported.
did_error
Shared
false
I actually don't think this tool needs a global
Error
type.SInce the time you've made this, I made it the main thread's responsibility to exit if an error occurs: https://github.com/savoryink/setfont/blob/8f8db2ae2447b8321bfe81c75690eff381ecddb3/src/main.rs#L99-L101
I think instead of a global error,
App::apply
could returnResult<(), Box<dyn std::error::Error>>
, which then gets reported where it returns: https://github.com/savoryink/setfont/blob/8f8db2ae2447b8321bfe81c75690eff381ecddb3/src/main.rs#L93-L95If we're doing that approach, then
did_error
doesn't need to belong inShared
and instead can be updated tofalse
where the error gets reported.