Closed cutterbl closed 12 years ago
Ah dang, the error throws more usefully in Railo and OpenBD (you get the Java error type rather than 'Object'). I'll make a fix.
Are you able to supply the code to get into the call stack and examine the error (I'm not running ACF anywhere)? I guess it needs to be something like:
var badJsMessage = "";
try {
compressor = $loadJavaClass( 'com.yahoo.platform.yui.compressor.JavaScriptCompressor' ).init( input, reporter );
compressor.compress( output, javaCast('int', arguments.linebreak), javaCast('boolean', arguments.munge), javaCast('boolean',arguments.verbose), javaCast('boolean', arguments.preserveAllSemiColons), javaCast('boolean',arguments.disableOptimizations) );
} catch( 'org.mozilla.javascript.EvaluatorException' e ){
badJsMessage = e.message;
} catch( 'Object' e ){
if ( e.cause.type EQ 'org.mozilla.javascript.EvaluatorException' ) {
badJsMessage = e.cause.message;
} else {
$throw( argumentCollection = e );
}
}
if ( Len( badJsMessage ) ) {
$throw( type="org.cfstatic.util.YuiCompressor.badJs", message="There was an error compressing your javascript: '#badJsMessage#'. Please see the error detail for the problematic javascript source.", detail=arguments.source );
}
When a file has bad JS, and your app initializes and tries to minify files, a hard CF error is thrown. Currently the compressJs() method of the YuiCompressor.cfc has the following:
This doesn't catch the EvaluatorException, because that exception is nested in the call stack. The error thrown is of type 'Object' stating
That message has a Cause of error type 'java.lang.reflect.InvocationTargetException', with the message of [empty string]. This error has a Cause of type 'org.mozilla.javascript.EvaluatorException'.