Skip to content

Commit 0e3b3f6

Browse files
authored
[#120] feat(DaedalusVm): report information about symbol name in exception
1 parent 0757651 commit 0e3b3f6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

include/zenkit/DaedalusVm.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ namespace zenkit {
502502
template <typename R, typename... P>
503503
void override_function(std::string_view name, std::function<R(P...)> const& callback) {
504504
auto* sym = find_symbol_by_name(name);
505-
if (sym == nullptr) throw DaedalusVmException {"symbol not found"};
505+
if (sym == nullptr) throw DaedalusSymbolNotFound {std::string {name}};
506506
if (sym->is_external()) throw DaedalusVmException {"symbol is already an external"};
507507

508508
if constexpr (!std::same_as<void, R>) {
@@ -571,8 +571,8 @@ namespace zenkit {
571571
/// \param callback The C++ function to register as the external.
572572
void override_function(std::string_view name, std::function<DaedalusNakedCall(DaedalusVm&)> const& callback) {
573573
auto* sym = find_symbol_by_name(name);
574-
if (sym == nullptr) throw DaedalusVmException {"symbol not found"};
575-
if (sym->is_external()) throw DaedalusVmException {"symbol is already an external"};
574+
if (sym == nullptr) throw DaedalusSymbolNotFound {std::string {name}};
575+
if (sym->is_external()) throw DaedalusVmException {"symbol " + sym->name() + " is already an external"};
576576

577577
_m_function_overrides[sym->address()] = [callback](DaedalusVm& machine) { callback(machine); };
578578
}

0 commit comments

Comments
 (0)