unsigned id=parse_int();
EnumMap::iterator i=enums.find(id);
if(i==enums.end())
- throw KeyError("Unknown enum");
+ throw KeyError("Unknown enum", lexical_cast(id));
return i->second;
}
void add(const std::string &name, T *d)
{
if(items.count(name))
- throw KeyError("Duplicate key '"+name+"' in collection");
+ throw KeyError("Duplicate key in collection", name);
items[name]=new Item<typename RemoveConst<T>::Type>(d);
}
ItemMap::const_iterator i=items.find(name);
if(i==items.end())
- throw KeyError("Item '"+name+"' not found in collection");
+ throw KeyError("Item not found in collection", name);
const Item<NCT> *item=dynamic_cast<const Item<NCT> *>(i->second);
if(!item)
- throw TypeError("Item '"+name+"' is not of correct type");
+ throw TypeError("Type mismatch on item '"+name+"'");
return item->data;
}
return d;
}
}
- throw KeyError("Item '"+name+"' not found in collection");
+ throw KeyError("Item not found in collection", name);
}
const Item<NCT> *item=dynamic_cast<const Item<NCT> *>(i->second);
if(!item)
- throw TypeError("Item '"+name+"' is not of correct type");
+ throw TypeError("Type mismatch on item '"+name+"'");
return item->data;
}
cur_st=&st;
ActionMap::iterator j=actions.find(st.keyword);
if(j==actions.end())
- throw KeyError(st.get_location()+": Unknown keyword '"+st.keyword+"'");
+ throw KeyError(st.get_location()+": Unknown keyword", st.keyword);
if(j->second)
j->second->execute(*this, st);
cur_st=0;