Enhance and correct error messages
This commit is contained in:
@@ -688,10 +688,9 @@ namespace chaiscript
|
||||
/**
|
||||
* Dump object info to stdout
|
||||
*/
|
||||
void dump_object(Boxed_Value o) const
|
||||
void dump_object(const Boxed_Value &o) const
|
||||
{
|
||||
Type_Info ti = o.get_type_info();
|
||||
std::cout << (ti.is_const()?"const ":"") << get_type_name(ti) << std::endl;
|
||||
std::cout << (o.is_const()?"const ":"") << type_name(o) << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -783,7 +782,7 @@ namespace chaiscript
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string type_name(Boxed_Value obj) const
|
||||
std::string type_name(const Boxed_Value &obj) const
|
||||
{
|
||||
return get_type_name(obj.get_type_info());
|
||||
}
|
||||
|
@@ -587,17 +587,14 @@ namespace chaiscript
|
||||
class dispatch_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
dispatch_error() noexcept
|
||||
: std::runtime_error("No matching function to dispatch to")
|
||||
dispatch_error(const std::vector<Boxed_Value> &t_bvs)
|
||||
: std::runtime_error("Error with function dispatch"), parameters(t_bvs)
|
||||
{
|
||||
}
|
||||
|
||||
dispatch_error(bool is_const) noexcept
|
||||
: std::runtime_error(std::string("No matching function to dispatch to") + (is_const?", parameter is const":""))
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~dispatch_error() noexcept {}
|
||||
|
||||
std::vector<Boxed_Value> parameters;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -631,7 +628,7 @@ namespace chaiscript
|
||||
++begin;
|
||||
}
|
||||
|
||||
throw exception::dispatch_error(plist.empty()?false:plist[0].is_const());
|
||||
throw exception::dispatch_error(plist);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user