Improve error reporting

This commit is contained in:
Stephan Bergmann
2012-03-23 16:19:03 +01:00
parent 0b9fda25f3
commit 4b6988b432

View File

@@ -88,8 +88,13 @@ public class ScriptProviderForJava
} }
catch ( com.sun.star.uno.RuntimeException re ) catch ( com.sun.star.uno.RuntimeException re )
{ {
throw new ScriptFrameworkErrorException( "Failed to create script object: " + re.getMessage(), ScriptFrameworkErrorException e2 =
null, scriptData.getLanguageName(), language, ScriptFrameworkErrorType.UNKNOWN ); new ScriptFrameworkErrorException(
"Failed to create script object: " + re,
null, scriptData.getLanguageName(), language,
ScriptFrameworkErrorType.UNKNOWN );
e2.initCause( re );
throw e2;
} }
} }
@@ -158,9 +163,11 @@ class ScriptImpl implements XScript
catch ( Exception e ) catch ( Exception e )
{ {
LogUtils.DEBUG( LogUtils.getTrace( e ) ); LogUtils.DEBUG( LogUtils.getTrace( e ) );
throw new com.sun.star.uno.RuntimeException( com.sun.star.uno.RuntimeException e2 =
"Error constructing ScriptProvider: " new com.sun.star.uno.RuntimeException(
+ e.getMessage() ); "Error constructing ScriptProvider: " + e );
e2.initCause( e );
throw e2;
} }
LogUtils.DEBUG("ScriptImpl [java] script data = " + metaData ); LogUtils.DEBUG("ScriptImpl [java] script data = " + metaData );
@@ -211,26 +218,35 @@ class ScriptImpl implements XScript
catch (MalformedURLException mfe ) catch (MalformedURLException mfe )
{ {
// Framework error // Framework error
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
mfe.getMessage(), null, new ScriptFrameworkErrorException(
mfe.toString(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.MALFORMED_URL ); ScriptFrameworkErrorType.MALFORMED_URL );
e2.initCause( mfe );
throw e2;
} }
catch (NoSuitableClassLoaderException ncl ) catch (NoSuitableClassLoaderException ncl )
{ {
// Framework error // Framework error
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
ncl.getMessage(), null, new ScriptFrameworkErrorException(
ncl.toString(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.UNKNOWN ); ScriptFrameworkErrorType.UNKNOWN );
e2.initCause( ncl );
throw e2;
} }
catch (ArrayStoreException e ) catch (ArrayStoreException e )
{ {
// Framework error // Framework error
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
e.getMessage(), null, new ScriptFrameworkErrorException(
e.toString(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.UNKNOWN ); ScriptFrameworkErrorType.UNKNOWN );
e2.initCause( e );
throw e2;
} }
ArrayList invocationArgList = new ArrayList(); ArrayList invocationArgList = new ArrayList();
@@ -281,19 +297,25 @@ class ScriptImpl implements XScript
catch( NoSuchMethodException e ) catch( NoSuchMethodException e )
{ {
// Framework error // Framework error
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
e.getMessage(), null, new ScriptFrameworkErrorException(
e.toString(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); ScriptFrameworkErrorType.NO_SUCH_SCRIPT );
e2.initCause( e );
throw e2;
} }
} }
catch ( ClassNotFoundException e ) catch ( ClassNotFoundException e )
{ {
// Framework error // Framework error
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
e.getMessage(), null, new ScriptFrameworkErrorException(
e.toString(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); ScriptFrameworkErrorType.NO_SUCH_SCRIPT );
e2.initCause( e );
throw e2;
} }
LogUtils.DEBUG( "Starting Invoke on Proxy ..." ); LogUtils.DEBUG( "Starting Invoke on Proxy ..." );
@@ -310,18 +332,23 @@ class ScriptImpl implements XScript
} }
catch ( java.lang.IllegalArgumentException iae ) catch ( java.lang.IllegalArgumentException iae )
{ {
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
new ScriptFrameworkErrorException(
iae.getMessage(), null, iae.getMessage(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.UNKNOWN ); ScriptFrameworkErrorType.UNKNOWN );
e2.initCause( iae );
throw e2;
} }
catch ( java.lang.IllegalAccessException ia ) catch ( java.lang.IllegalAccessException ia )
{ {
throw new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 =
ia.getMessage(), null, new ScriptFrameworkErrorException(
ia.toString(), null,
metaData.getLanguageName(), metaData.getLanguage(), metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.UNKNOWN ); ScriptFrameworkErrorType.UNKNOWN );
e2.initCause( ia );
throw e2;
} }
catch ( java.lang.reflect.InvocationTargetException ite ) catch ( java.lang.reflect.InvocationTargetException ite )
{ {