DslCompiler: Properly output errors and termination line
This fixes a number of obnoxious miscellaneous issues, summarized below. * src/current/src/com/lovullo/dslc/DslCompiler.java (DslCompiler)[compile]: Output termination line (DONE) on missing destination path error. Always output exception message before termination line (otherwise it won't output to the user). Output termination line and remove destination file for XSD failure.master
parent
f62f2ccacb
commit
6e4d42f926
|
@ -71,18 +71,14 @@ public class DslCompiler
|
|||
HashMap<String,String> params
|
||||
) throws Exception
|
||||
{
|
||||
// validate before compilation
|
||||
if ( cmd.equals( "compile" ) )
|
||||
{
|
||||
_xsd.validate( doc );
|
||||
}
|
||||
|
||||
if ( dest.equals( "" ) )
|
||||
{
|
||||
System.err.printf(
|
||||
"fatal: no destination path provided\n"
|
||||
);
|
||||
|
||||
System.err.println( "DONE 1 " + dest );
|
||||
|
||||
System.exit( 4 );
|
||||
}
|
||||
|
||||
|
@ -90,6 +86,12 @@ public class DslCompiler
|
|||
File destfile = new File( dest );
|
||||
try
|
||||
{
|
||||
// validate before compilation
|
||||
if ( cmd.equals( "compile" ) )
|
||||
{
|
||||
_xsd.validate( doc );
|
||||
}
|
||||
|
||||
_transform(
|
||||
src,
|
||||
doc,
|
||||
|
@ -106,10 +108,12 @@ public class DslCompiler
|
|||
// delete the output file; it's garbage
|
||||
destfile.delete();
|
||||
|
||||
System.err.println( "DONE 1 " + dest );
|
||||
// this must be output _before_ the DONE line to ensure that
|
||||
// it is considered to be part of the compilation output for
|
||||
// this file
|
||||
System.err.printf( "fatal: %s\n", e.getMessage() );
|
||||
|
||||
// be verbose and unprofessional.
|
||||
throw e;
|
||||
System.err.println( "DONE 1 " + dest );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue