Trap query errors and use a char pointer instead of an std::string to signal errors