Handing filter configuration errors

0 views
Skip to first unread message

christian

unread,
Dec 10, 2005, 2:55:38 PM12/10/05
to cherrypy-devel
Hi guys,

How should we handle errors in the config file? Maybe this has more to
do with filter config than config in general, so here goes an example:

[/style]
static_filter.on = True

Woops. Missing something there, aren't I? What I get in return is a
500 error in my log and this traceback:

------------------------
10/Dec/2005:13:25:51 HTTP INFO Traceback (most recent call last):
File
"C:\Python24\lib\site-packages\cherrypy_src\cherrypy\_cphttptools.py",
line 91, in _run
applyFilters('before_main')
File
"C:\Python24\lib\site-packages\cherrypy_src\cherrypy\filters\__init__.py",
line 124, in applyFilters
method()
File
"C:\Python24\lib\site-packages\cherrypy_src\cherrypy\filters\staticfilter.py",
line 36, in before_main
filename = os.path.join(staticDir, extraPath)
File "C:\Python24\lib\ntpath.py", line 90, in join
assert len(path) > 0
TypeError: len() of unsized object
---------------------------

Should that be the response or should there be some more descriptive
error in the log? Something along the lines of "<date> CONFIG WARNING
staticfilter.on = True without corresponding .file, .dir or .match".
Along with a 404 instead of a 500?

Or maybe the 500 is the right approach and the filter just needs to
raise a different exception with a more descriptive message? Any
thoughts?

Christian
http://www.dowski.com

Robert Brewer

unread,
Dec 10, 2005, 11:10:25 PM12/10/05
to cherryp...@googlegroups.com
christian wrote:
> How should we handle errors in the config file?
> ...should there be some more descriptive error

> in the log? Something along the lines of
> "<date> CONFIG WARNING staticfilter.on = True
> without corresponding .file, .dir or .match".

IMO, CherryPy should refuse to start if there are such errors.

> Along with a 404 instead of a 500?

I don't think it should get that far (to the request level).


Robert Brewer
System Architect
Amor Ministries
fuma...@amor.org

winmail.dat

christian

unread,
Dec 12, 2005, 2:13:50 PM12/12/05
to cherrypy-devel
Robert Brewer wrote:
> christian wrote:
> > How should we handle errors in the config file?
> > ...should there be some more descriptive error
> > in the log? Something along the lines of
> > "<date> CONFIG WARNING staticfilter.on = True
> > without corresponding .file, .dir or .match".
>
> IMO, CherryPy should refuse to start if there are such errors.

Good point. I'm glad I ask questions before I run off and submit
changes to svn :-)

Christian
http://www.dowski.com

Reply all
Reply to author
Forward
0 new messages