RE: [Seaside 2.6][VW7.4.1] ERROR_FILE_NOT_FOUND

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: [Seaside 2.6][VW7.4.1] ERROR_FILE_NOT_FOUND

Steven Kelly
Filename>>isDirectory doesn't itself handle errors, but
WebSiteFile>>handleFileRequest does (at least in 7.4). You should make
sure that your webSite is not debuggable (VisualLauncher | Web | Debug
Mode), else #notFoundAnswerFor: will correctly set the response status
to 404, but then pass the exception, which might well result in a 500
overriding the 404.

If that doesn't help, I'd check what the actual error is, and why it
isn't being caught by OsInnaccessibleError. A quick "print it" on the
code below, essentially #handleFileRequest, shows simple "file does not
exist" cases work fine, causing an OsInaccessibleError.

file := 'foo.bar' asFilename.
errorHandlers := HandlerList new.
errorHandlers on: OsInaccessibleError handle: [:ex | ex return: 1].
errorHandlers on: ForbiddenFileError handle: [:ex | ex return: 2].
errorHandlers handleDo: [
        file isDirectory not
                ifTrue: [ 3 ]
                ifFalse: [ 4 ] ].
"print it => 1"

HTH,
Steve

> From: Carl Gundel [mailto:[hidden email]]
> >> I'm puzzled why VisualWave throws an exception and opens a
> >> walkback when I
> >> try to access a file resource that doesn't exist.  Why
> >> doesn't it return a 404 to the browser?
> >>
> >> \Unhandled exception: ERROR_FILE_NOT_FOUND
> >>    ("c:\vw7.4.1\bin\win\ribbit.png")
> >> FileErrorHolder class(OSErrorHolder class)>>reportProceedingOn:
> >> FileErrorHolder(OSErrorHolder)>>reportErrorProceeding
> >> optimized [] in OSErrorHolder class>>initializeErrorActions
> >> SystemError>>handleErrorFor:
> >> FATFilename(Filename)>>isDirectory
> >> VisualWave.WebSiteFile>>canServeFile
> >> optimized [] in VisualWave.WebSiteFile>>handleFileRequest
> >> SignalHandler>>handleDo:
> >> SignalHandler>>handleDo:
> >> HandlerList>>handleDo:
> >> VisualWave.WebSiteFile>>handleFileRequest
> >> VisualWave.WebSiteFile>>doGet
> >> VisualWave.WebSiteFile(VisualWave.SingleThreadModelServlet)>>
> >>    service:response:
> >> VisualWave.ServletHandler>>basicEvaluate
> >> optimized [] in VisualWave.WWHandler>>evaluate