diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-04-09 09:13:35 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-04-09 09:13:35 +0100 |
| commit | d4b1138e2fccd625479adf3a34cfa1d8a04a83ef (patch) | |
| tree | 741cf25e5645e9566994a65b920c1a661fbb577c /src | |
| parent | 9b98aa61a896b28e1ed7668da85790fd59aaa0b5 (diff) | |
Use a specific startup_error exception type to get a nicer message
Fixes #424
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc index 35375c63..e14385ea 100644 --- a/src/main.cc +++ b/src/main.cc @@ -33,6 +33,11 @@ using namespace Kakoune; +struct startup_error : Kakoune::runtime_error +{ + using Kakoune::runtime_error::runtime_error; +}; + String runtime_directory() { char relpath[PATH_MAX+1]; @@ -384,7 +389,7 @@ std::unique_ptr<UserInterface> create_local_ui(UIType ui_type) }; if (not isatty(1)) - throw runtime_error("stdout is not a tty"); + throw startup_error("stdout is not a tty"); if (not isatty(0)) { @@ -837,6 +842,11 @@ int main(int argc, char* argv[]) generate_switches_doc(param_desc.switches))); return -1; } + catch (startup_error& error) + { + write_stderr(format("Could not start kakoune: {}\n", error.what())); + return -1; + } catch (Kakoune::exception& error) { write_stderr(format("uncaught exception ({}):\n{}", typeid(error).name(), error.what())); |
