Skip to content

Improve exception error messages#109

Open
muesli4 wants to merge 1 commit into
hyperrealm:masterfrom
muesli4:master
Open

Improve exception error messages#109
muesli4 wants to merge 1 commit into
hyperrealm:masterfrom
muesli4:master

Conversation

@muesli4

@muesli4 muesli4 commented Feb 24, 2018

Copy link
Copy Markdown

Proposed improvement to #108. Let me know what you think about it or if that's something you don't want to change.

@ilyapopov

Copy link
Copy Markdown

Maybe it is better to just derive from std::runtime_error. This way you get wgat() etc. for free.

@muesli4

muesli4 commented Sep 5, 2019

Copy link
Copy Markdown
Author

Maybe it is better to just derive from std::runtime_error. This way you get wgat() etc. for free.

The thing is that the existing code is not really composable in a way that makes refactoring easy. Is C++11 allowed? If so I can make it work with std::runtime_error (because I require constructor delegation).

@muesli4

muesli4 commented Sep 5, 2019

Copy link
Copy Markdown
Author

I updated the exception classes to inherit from std::runtime_error. The examples seem to work and the tests pass. I can condense this into one commit.

@muesli4

muesli4 commented Dec 26, 2019

Copy link
Copy Markdown
Author

I rebased my changes on the recent version and it is only one commit now.

@muesli4

muesli4 commented Dec 26, 2019

Copy link
Copy Markdown
Author

I deliberately caused some of the errors:

> mpd-touch-screen-gui
mpd-touch-screen-gui 0.0.1
Found configuration file: /home/moritz/.config/mpd-touch-screen-gui/program.conf
setting not found exception: program.[default_font]
> mpd-touch-screen-gui
mpd-touch-screen-gui 0.0.1
Found configuration file: /home/moritz/.config/mpd-touch-screen-gui/program.conf
setting type exception: program.default_font.path
> mpd-touch-screen-gui
mpd-touch-screen-gui 0.0.1
Found configuration file: /home/moritz/.config/mpd-touch-screen-gui/program.conf
parse exception: in /home/moritz/.config/mpd-touch-screen-gui/program.conf, at line 6: syntax error
> mpd-touch-screen-gui
mpd-touch-screen-gui 0.0.1
Found configuration file: /home/moritz/.config/mpd-touch-screen-gui/program.conf
parse exception: in /home/moritz/.config/mpd-touch-screen-gui/program.conf, at line 6: duplicate setting name

@muesli4

muesli4 commented Sep 5, 2020

Copy link
Copy Markdown
Author

Is there anything I can improve or change such that this will be merged?

@hyperrealm hyperrealm left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long delay. :-(

Comment thread lib/libconfigcpp.c++ Outdated
Comment thread lib/libconfigcpp.c++ Outdated
Comment thread lib/libconfigcpp.c++ Outdated
* Inherit exceptions from std::runtime_error
* Refactor error message functions
* Refactor path construction functions
* Add path to error messages
@muesli4

muesli4 commented Dec 29, 2022

Copy link
Copy Markdown
Author

It has been a long time but I took I few minutes trying to get this done. So, I guess better late than never. Let me know if you want anything changed (even small details).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants