1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-25 21:16:38 +03:00

Notify user when some hooks failed

This commit is contained in:
Maxime Coste 2015-07-08 14:00:50 +01:00
parent 883a14e853
commit f1c286e592

View File

@ -3,6 +3,8 @@
#include "containers.hh" #include "containers.hh"
#include "context.hh" #include "context.hh"
#include "buffer_utils.hh" #include "buffer_utils.hh"
#include "display_buffer.hh"
#include "face_registry.hh"
#include "regex.hh" #include "regex.hh"
namespace Kakoune namespace Kakoune
@ -48,6 +50,7 @@ void HookManager::run_hook(StringView hook_name,
return; return;
auto& disabled_hooks = context.options()["disabled_hooks"].get<Regex>(); auto& disabled_hooks = context.options()["disabled_hooks"].get<Regex>();
bool hook_error = false;
for (auto& hook : hook_list_it->second) for (auto& hook : hook_list_it->second)
{ {
if (not hook.first.empty() and not disabled_hooks.empty() and if (not hook.first.empty() and not disabled_hooks.empty() and
@ -60,10 +63,16 @@ void HookManager::run_hook(StringView hook_name,
} }
catch (runtime_error& err) catch (runtime_error& err)
{ {
hook_error = true;
write_to_debug_buffer(format("error running hook {}/{}: {}", write_to_debug_buffer(format("error running hook {}/{}: {}",
hook_name, hook.first, err.what())); hook_name, hook.first, err.what()));
} }
} }
if (hook_error)
context.print_status({
format("Error running hooks for '{}' '{}', see *debug* buffer",
hook_name, param), get_face("Error") });
} }
} }