arrange for error info about missing helpers to trickle up to the user

This commit is contained in:
dockes
2007-02-06 18:01:58 +00:00
parent faeb96cb01
commit 33dd17daeb
5 changed files with 49 additions and 13 deletions
+9 -3
View File
@@ -1,5 +1,5 @@
#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
/*
* 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()) {
Rcl::Doc doc; string ipath;
collectIpathAndMT(doc, ipath);
LOGERR(("FileInterner::internfile: next_document error [%s%s%s]\n",
m_fn.c_str(), ipath.empty()?"":"|", ipath.c_str()));
m_reason = m_handlers.back()->get_error();
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();
continue;
}
+9 -2
View File
@@ -16,7 +16,7 @@
*/
#ifndef _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 <vector>
@@ -79,7 +79,7 @@ class FileInterner {
Status internfile(Rcl::Doc& doc, string &ipath);
/** 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
* 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,
const string& ipath, const string& mtype);
const string& getReason() const {return m_reason;}
private:
static const unsigned int MAXHANDLERS = 20;
RclConfig *m_cfg;
@@ -100,9 +102,14 @@ class FileInterner {
// m_tdir and m_tfile are used only for decompressing input file if needed
const string& m_tdir;
string m_tfile;
// Filter stack, path to the current document from which we're
// fetching subdocs
vector<Dijon::Filter*> m_handlers;
// Temporary files used for decoding the current stack
bool m_tmpflgs[MAXHANDLERS];
vector<TempFile> m_tempfiles;
// Error data if any
string m_reason;
void tmpcleanup();
bool dijontorcl(Rcl::Doc&);
+7 -1
View File
@@ -1,5 +1,5 @@
#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
/*
* This program is free software; you can redistribute it and/or modify
@@ -45,6 +45,7 @@ bool MimeHandlerExec::next_document()
if (params.empty()) {
// Hu ho
LOGERR(("MimeHandlerExec::mkDoc: empty params\n"));
m_reason = "RECFILTERROR BADCONFIG";
return false;
}
@@ -58,6 +59,7 @@ bool MimeHandlerExec::next_document()
// Execute command and store the result text, which is supposedly html
string& html = m_metaData["content"];
html.erase();
ExecCmd mexec;
MEAdv adv;
mexec.setAdvise(&adv);
@@ -67,6 +69,10 @@ bool MimeHandlerExec::next_document()
if (status) {
LOGERR(("MimeHandlerExec: command status 0x%x: %s\n",
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;
}