mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-28 01:00:28 +03:00
Do not expose C++ typeid().name to user facing errors on wrong option type
Fixes #2079
This commit is contained in:
parent
5e75748556
commit
54b62cbef7
@ -7,6 +7,7 @@
|
||||
#include "file.hh"
|
||||
#include "remote.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "client_manager.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "event_manager.hh"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "context.hh"
|
||||
#include "flags.hh"
|
||||
#include "optional.hh"
|
||||
#include "option_types.hh"
|
||||
#include "ranges.hh"
|
||||
#include "register_manager.hh"
|
||||
#include "shell_manager.hh"
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "completion.hh"
|
||||
#include "file.hh"
|
||||
#include "context.hh"
|
||||
#include "option_types.hh"
|
||||
#include "regex.hh"
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "buffer.hh"
|
||||
#include "exception.hh"
|
||||
#include "flags.hh"
|
||||
#include "option_types.hh"
|
||||
#include "ranked_match.hh"
|
||||
#include "regex.hh"
|
||||
#include "string.hh"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "highlighter_group.hh"
|
||||
#include "line_modification.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "parameters_parser.hh"
|
||||
#include "ranges.hh"
|
||||
#include "regex.hh"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "display_buffer.hh"
|
||||
#include "face_registry.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "ranges.hh"
|
||||
#include "regex.hh"
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "face_registry.hh"
|
||||
#include "insert_completer.hh"
|
||||
#include "normal.hh"
|
||||
#include "option_types.hh"
|
||||
#include "regex.hh"
|
||||
#include "register_manager.hh"
|
||||
#include "hash_map.hh"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "regex.hh"
|
||||
#include "window.hh"
|
||||
#include "word_db.hh"
|
||||
#include "option_types.hh"
|
||||
#include "utf8_iterator.hh"
|
||||
#include "user_interface.hh"
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "file.hh"
|
||||
#include "flags.hh"
|
||||
#include "option_manager.hh"
|
||||
#include "option_types.hh"
|
||||
#include "ranges.hh"
|
||||
#include "regex.hh"
|
||||
#include "register_manager.hh"
|
||||
|
@ -182,7 +182,8 @@ template<typename T> const T& Option::get() const
|
||||
{
|
||||
auto* typed_opt = dynamic_cast<const TypedOption<T>*>(this);
|
||||
if (not typed_opt)
|
||||
throw runtime_error(format("option '{}' is not of type '{}'", name(), typeid(T).name()));
|
||||
throw runtime_error(format("option '{}' is not of type '{}'", name(),
|
||||
option_type_name(Meta::Type<T>{})));
|
||||
return typed_opt->get();
|
||||
}
|
||||
|
||||
@ -195,7 +196,8 @@ template<typename T> void Option::set(const T& val, bool notify)
|
||||
{
|
||||
auto* typed_opt = dynamic_cast<TypedOption<T>*>(this);
|
||||
if (not typed_opt)
|
||||
throw runtime_error(format("option '{}' is not of type '{}'", name(), typeid(T).name()));
|
||||
throw runtime_error(format("option '{}' is not of type '{}'", name(),
|
||||
option_type_name(Meta::Type<T>{})));
|
||||
return typed_opt->set(val, notify);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "context.hh"
|
||||
#include "flags.hh"
|
||||
#include "optional.hh"
|
||||
#include "option_types.hh"
|
||||
#include "regex.hh"
|
||||
#include "string.hh"
|
||||
#include "unicode.hh"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "file.hh"
|
||||
#include "flags.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "regex.hh"
|
||||
|
||||
#include <cstring>
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "client.hh"
|
||||
#include "buffer_utils.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "utils.hh"
|
||||
#include "line_modification.hh"
|
||||
#include "option_types.hh"
|
||||
#include "utf8_iterator.hh"
|
||||
#include "unit_tests.hh"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user