diff --git a/Application.cfc b/Application.cfc index efa4ba9e..149e6b60 100644 --- a/Application.cfc +++ b/Application.cfc @@ -18,7 +18,8 @@ component { // create your FW/1 application: request._framework_one = new framework.one( { trace = true, - base = getDirectoryFromPath( CGI.SCRIPT_NAME ) + missingview = 'main.missingview', + base = getDirectoryFromPath( CGI.SCRIPT_NAME ) .replaceFirst( getContextRoot(), '' ) & 'introduction' } ); diff --git a/framework/one.cfc b/framework/one.cfc index 73fa7618..0cee02ee 100644 --- a/framework/one.cfc +++ b/framework/one.cfc @@ -742,14 +742,24 @@ component { } // setup the new controller action, based on the error action: request._fw1.controllers = [ ]; - - if ( structKeyExists( variables, 'framework' ) && structKeyExists( variables.framework, 'error' ) ) { - request.action = variables.framework.error; + var key = 'error'; + var defaultAction = 'main.error'; + try { + if ( exception.type == 'fw1.viewnotfound' && structKeyExists( variables.framework, 'missingview' ) ) { + key = 'missingview'; + // shouldn't be needed -- key will be present in framework config + defaultAction = 'main.missingview'; + } + } catch ( any e ) { + // leave it as exception + } + if ( structKeyExists( variables, 'framework' ) && structKeyExists( variables.framework, key ) ) { + request.action = variables.framework[ key ]; } else { // this is an edge case so we don't bother with subsystems etc // (because if part of the framework defaults are not present, // we'd have to do a lot of conditional logic here!) - request.action = 'main.error'; + request.action = defaultAction; } // ensure request.context is available if ( !structKeyExists( request, 'context' ) ) { diff --git a/introduction/views/main/missingview.cfm b/introduction/views/main/missingview.cfm new file mode 100644 index 00000000..5aa6fdd5 --- /dev/null +++ b/introduction/views/main/missingview.cfm @@ -0,0 +1,2 @@ +I'm sorry, but no such view is available! +