improve handling of missing helpers messages
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.26 2007-02-06 18:01:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.27 2007-02-08 17:05:12 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -223,6 +223,37 @@ bool FileInterner::dataToTempFile(const string& dt, const string& mt,
|
||||
return true;
|
||||
}
|
||||
|
||||
// See if the error string is formatted as a missing helper message,
|
||||
// accumulate helper name if it is
|
||||
void FileInterner::maybeExternalMissing(const string& msg)
|
||||
{
|
||||
if (msg.find("RECFILTERROR") == 0) {
|
||||
list<string> lerr;
|
||||
stringToStrings(msg, lerr);
|
||||
if (lerr.size() > 2) {
|
||||
list<string>::iterator it = lerr.begin();
|
||||
it++;
|
||||
if (*it == "HELPERNOTFOUND") {
|
||||
it++;
|
||||
m_missingExternal.push_back(it->c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const list<string>& FileInterner::getMissingExternal()
|
||||
{
|
||||
m_missingExternal.sort();
|
||||
m_missingExternal.unique();
|
||||
return m_missingExternal;
|
||||
}
|
||||
void FileInterner::getMissingExternal(string& out)
|
||||
{
|
||||
m_missingExternal.sort();
|
||||
m_missingExternal.unique();
|
||||
stringsToString(m_missingExternal, out);
|
||||
}
|
||||
|
||||
static inline bool getKeyValue(const map<string, string>& docdata,
|
||||
const string& key, string& value)
|
||||
{
|
||||
@@ -368,6 +399,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
|
||||
Rcl::Doc doc; string ipath;
|
||||
collectIpathAndMT(doc, ipath);
|
||||
m_reason = m_handlers.back()->get_error();
|
||||
maybeExternalMissing(m_reason);
|
||||
LOGERR(("FileInterner::internfile: next_document error [%s%s%s] %s\n",
|
||||
m_fn.c_str(), ipath.empty()?"":"|", ipath.c_str(),
|
||||
m_reason.c_str()));
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
#ifndef _INTERNFILE_H_INCLUDED_
|
||||
#define _INTERNFILE_H_INCLUDED_
|
||||
/* @(#$Id: internfile.h,v 1.13 2007-02-08 12:25:49 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: internfile.h,v 1.14 2007-02-08 17:05:12 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -91,6 +91,8 @@ class FileInterner {
|
||||
const string& ipath, const string& mtype);
|
||||
|
||||
const string& getReason() const {return m_reason;}
|
||||
const list<string>& getMissingExternal();
|
||||
void getMissingExternal(string& missing);
|
||||
|
||||
private:
|
||||
static const unsigned int MAXHANDLERS = 20;
|
||||
@@ -110,12 +112,15 @@ class FileInterner {
|
||||
vector<TempFile> m_tempfiles;
|
||||
// Error data if any
|
||||
string m_reason;
|
||||
// Missing external programs
|
||||
list<string> m_missingExternal;
|
||||
|
||||
void tmpcleanup();
|
||||
bool dijontorcl(Rcl::Doc&);
|
||||
void collectIpathAndMT(Rcl::Doc&, string& ipath) const;
|
||||
bool dataToTempFile(const string& data, const string& mt, string& fn);
|
||||
void popHandler();
|
||||
void maybeExternalMissing(const string& msg);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user