arrange for error info about missing helpers to trickle up to the user
This commit is contained in:
parent
faeb96cb01
commit
33dd17daeb
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.51 2007-02-02 10:12:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.52 2007-02-06 18:01:57 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -432,7 +432,7 @@ DbIndexer::processone(const std::string &fn, const struct stat *stp,
|
|||||||
Rcl::Doc fileDoc;
|
Rcl::Doc fileDoc;
|
||||||
fileDoc.fmtime = ascdate;
|
fileDoc.fmtime = ascdate;
|
||||||
fileDoc.utf8fn = utf8fn;
|
fileDoc.utf8fn = utf8fn;
|
||||||
fileDoc.mimetype = interner.get_mimetype();
|
fileDoc.mimetype = interner.getMimetype();
|
||||||
if (!m_db.add(fn, fileDoc, stp))
|
if (!m_db.add(fn, fileDoc, stp))
|
||||||
return FsTreeWalker::FtwError;
|
return FsTreeWalker::FtwError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.25 2007-01-17 13:53:40 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.26 2007-02-06 18:01:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -367,8 +367,14 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
|
|||||||
if (!m_handlers.back()->next_document()) {
|
if (!m_handlers.back()->next_document()) {
|
||||||
Rcl::Doc doc; string ipath;
|
Rcl::Doc doc; string ipath;
|
||||||
collectIpathAndMT(doc, ipath);
|
collectIpathAndMT(doc, ipath);
|
||||||
LOGERR(("FileInterner::internfile: next_document error [%s%s%s]\n",
|
m_reason = m_handlers.back()->get_error();
|
||||||
m_fn.c_str(), ipath.empty()?"":"|", ipath.c_str()));
|
LOGERR(("FileInterner::internfile: next_document error [%s%s%s] %s\n",
|
||||||
|
m_fn.c_str(), ipath.empty()?"":"|", ipath.c_str(),
|
||||||
|
m_reason.c_str()));
|
||||||
|
// If fetching a specific document, this is fatal
|
||||||
|
if (m_forPreview) {
|
||||||
|
return FIError;
|
||||||
|
}
|
||||||
popHandler();
|
popHandler();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _INTERNFILE_H_INCLUDED_
|
#ifndef _INTERNFILE_H_INCLUDED_
|
||||||
#define _INTERNFILE_H_INCLUDED_
|
#define _INTERNFILE_H_INCLUDED_
|
||||||
/* @(#$Id: internfile.h,v 1.11 2007-01-15 13:06:38 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: internfile.h,v 1.12 2007-02-06 18:01:58 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -79,7 +79,7 @@ class FileInterner {
|
|||||||
Status internfile(Rcl::Doc& doc, string &ipath);
|
Status internfile(Rcl::Doc& doc, string &ipath);
|
||||||
|
|
||||||
/** Return the file's mimetype (useful for container files) */
|
/** Return the file's mimetype (useful for container files) */
|
||||||
const string& get_mimetype() {return m_mimetype;}
|
const string& getMimetype() {return m_mimetype;}
|
||||||
|
|
||||||
/** We normally always return text/plain data. A caller can request
|
/** We normally always return text/plain data. A caller can request
|
||||||
* that we stop conversion at the native document type (ie: text/html)
|
* that we stop conversion at the native document type (ie: text/html)
|
||||||
@ -90,6 +90,8 @@ class FileInterner {
|
|||||||
static bool idocTempFile(TempFile& temp, RclConfig *cnf, const string& fn,
|
static bool idocTempFile(TempFile& temp, RclConfig *cnf, const string& fn,
|
||||||
const string& ipath, const string& mtype);
|
const string& ipath, const string& mtype);
|
||||||
|
|
||||||
|
const string& getReason() const {return m_reason;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const unsigned int MAXHANDLERS = 20;
|
static const unsigned int MAXHANDLERS = 20;
|
||||||
RclConfig *m_cfg;
|
RclConfig *m_cfg;
|
||||||
@ -100,9 +102,14 @@ class FileInterner {
|
|||||||
// m_tdir and m_tfile are used only for decompressing input file if needed
|
// m_tdir and m_tfile are used only for decompressing input file if needed
|
||||||
const string& m_tdir;
|
const string& m_tdir;
|
||||||
string m_tfile;
|
string m_tfile;
|
||||||
|
// Filter stack, path to the current document from which we're
|
||||||
|
// fetching subdocs
|
||||||
vector<Dijon::Filter*> m_handlers;
|
vector<Dijon::Filter*> m_handlers;
|
||||||
|
// Temporary files used for decoding the current stack
|
||||||
bool m_tmpflgs[MAXHANDLERS];
|
bool m_tmpflgs[MAXHANDLERS];
|
||||||
vector<TempFile> m_tempfiles;
|
vector<TempFile> m_tempfiles;
|
||||||
|
// Error data if any
|
||||||
|
string m_reason;
|
||||||
|
|
||||||
void tmpcleanup();
|
void tmpcleanup();
|
||||||
bool dijontorcl(Rcl::Doc&);
|
bool dijontorcl(Rcl::Doc&);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.8 2006-12-15 12:40:02 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.9 2007-02-06 18:01:58 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -45,6 +45,7 @@ bool MimeHandlerExec::next_document()
|
|||||||
if (params.empty()) {
|
if (params.empty()) {
|
||||||
// Hu ho
|
// Hu ho
|
||||||
LOGERR(("MimeHandlerExec::mkDoc: empty params\n"));
|
LOGERR(("MimeHandlerExec::mkDoc: empty params\n"));
|
||||||
|
m_reason = "RECFILTERROR BADCONFIG";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ bool MimeHandlerExec::next_document()
|
|||||||
|
|
||||||
// Execute command and store the result text, which is supposedly html
|
// Execute command and store the result text, which is supposedly html
|
||||||
string& html = m_metaData["content"];
|
string& html = m_metaData["content"];
|
||||||
|
html.erase();
|
||||||
ExecCmd mexec;
|
ExecCmd mexec;
|
||||||
MEAdv adv;
|
MEAdv adv;
|
||||||
mexec.setAdvise(&adv);
|
mexec.setAdvise(&adv);
|
||||||
@ -67,6 +69,10 @@ bool MimeHandlerExec::next_document()
|
|||||||
if (status) {
|
if (status) {
|
||||||
LOGERR(("MimeHandlerExec: command status 0x%x: %s\n",
|
LOGERR(("MimeHandlerExec: command status 0x%x: %s\n",
|
||||||
status, cmd.c_str()));
|
status, cmd.c_str()));
|
||||||
|
// If the output string begins with RECFILTERROR, then it's
|
||||||
|
// interpretable error information
|
||||||
|
if (html.find("RECFILTERROR") == 0)
|
||||||
|
m_reason = html;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.14 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.15 2007-02-06 18:01:58 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -443,6 +443,7 @@ class LoadThread : public QThread {
|
|||||||
string tmpdir;
|
string tmpdir;
|
||||||
int loglevel;
|
int loglevel;
|
||||||
public:
|
public:
|
||||||
|
string reason;
|
||||||
LoadThread(int *stp, Rcl::Doc *odoc, string fn, string ip, string *mt)
|
LoadThread(int *stp, Rcl::Doc *odoc, string fn, string ip, string *mt)
|
||||||
: statusp(stp), out(odoc), filename(fn), ipath(ip), mtype(mt)
|
: statusp(stp), out(odoc), filename(fn), ipath(ip), mtype(mt)
|
||||||
{
|
{
|
||||||
@ -456,7 +457,6 @@ class LoadThread : public QThread {
|
|||||||
}
|
}
|
||||||
virtual void run() {
|
virtual void run() {
|
||||||
DebugLog::getdbl()->setloglevel(loglevel);
|
DebugLog::getdbl()->setloglevel(loglevel);
|
||||||
string reason;
|
|
||||||
if (!maketmpdir(tmpdir, reason)) {
|
if (!maketmpdir(tmpdir, reason)) {
|
||||||
QMessageBox::critical(0, "Recoll",
|
QMessageBox::critical(0, "Recoll",
|
||||||
Preview::tr("Cannot create temporary directory"));
|
Preview::tr("Cannot create temporary directory"));
|
||||||
@ -485,7 +485,8 @@ class LoadThread : public QThread {
|
|||||||
// a search term of course.
|
// a search term of course.
|
||||||
*statusp = 0;
|
*statusp = 0;
|
||||||
} else {
|
} else {
|
||||||
out->mimetype = interner.get_mimetype();
|
out->mimetype = interner.getMimetype();
|
||||||
|
reason = interner.getReason();
|
||||||
*statusp = -1;
|
*statusp = -1;
|
||||||
}
|
}
|
||||||
} catch (CancelExcept) {
|
} catch (CancelExcept) {
|
||||||
@ -586,9 +587,25 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
|
|||||||
if (cancel)
|
if (cancel)
|
||||||
return false;
|
return false;
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
|
QString explain;
|
||||||
|
if (lthr.reason.find("RECFILTERROR") == 0) {
|
||||||
|
list<string> lerr;
|
||||||
|
stringToStrings(lthr.reason, lerr);
|
||||||
|
if (lerr.size() > 2) {
|
||||||
|
list<string>::iterator it = lerr.begin();
|
||||||
|
it++;
|
||||||
|
if (*it == "HELPERNOTFOUND") {
|
||||||
|
it++;
|
||||||
|
explain = QString::fromAscii("<br>") +
|
||||||
|
tr("Missing helper program: ") +
|
||||||
|
QString::fromLocal8Bit(it->c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("Can't turn doc into internal rep for ") +
|
tr("Can't turn doc into internal "
|
||||||
fdoc.mimetype.c_str());
|
"representation for ") +
|
||||||
|
fdoc.mimetype.c_str() + explain);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Reset config just in case.
|
// Reset config just in case.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user