canonical / ubuntu-frame

The foundation for many embedded graphical display implementations
GNU General Public License v3.0
159 stars 21 forks source link

[Merged by Bors] - Use AbnormalExit for bad configuration options #124

Closed graysonguarino closed 1 year ago

graysonguarino commented 1 year ago

Fixes #99. I am curious if this PR should include the same change for each std::runtime_error in background_client.cpp. Is mir::AbnormalExit only for issues upon comeup?

AlanGriffiths commented 1 year ago

Is mir::AbnormalExit only for issues upon comeup?

Mostly yes. It about the intended audience of the logged message. When, for example, the configuration doesn't allow Mir to run we want the message to provide help in correcting it (without raising an issue for us to respond to).

These are "expected" exceptions - handling wrong user input.

...
Invalid colour (xxx) given in program argument

(We could improve that text though)

Other exceptions can occur when something goes wrong during execution. For these the intended audience is us, and we want more diagnostic information:

...
ERROR: /build/ubuntu-frame/parts/ubuntu-frame/src/background_client.cpp(180): Throw in function void BackgroundClient::set_colour(const string&, unsigned char (&)[4])
Dynamic exception type: boost::wrapexcept<std::runtime_error>
std::exception::what: Invalid colour (xxx) given in program argument
bors[bot] commented 1 year ago

Pull request successfully merged into main.

Build succeeded: