Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [acceleo] How to detect generation errors ?
[acceleo] How to detect generation errors ? [message #1004473] Wed, 23 January 2013 10:08 Go to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member

The errors occuring during template evaluation (e.g. evaluation of queries which navigate a null reference) are reported as Warnings in the Eclipse Log.

No exceptions are reported to the appliation, as they are caught internally by Acceleo.

How can the application detect any errors occuring in the generation ?
Is there any way to pass these exceptions to the applicaiton (e.g. a generation listener) ?

One idea (more of a work-around) would be to listen to the Eclipse Log for entries that contain specific execptions (AcceleoEvaluationException).
But it is not clear how to associate these entries with generations (esp. if there are several generations done concurrently).

Best regards
Vlad Gheorghe

Re: [acceleo] How to detect generation errors ? [message #1005935 is a reply to message #1004473] Tue, 29 January 2013 10:50 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member


Acceleo uses the standard logging mechanism of the Eclipse platform. If you wish to listen and react to the error logged, you should use an instance of "org.eclipse.core.runtime.ILogListener" that you should plug to the platform like this:

if (Platform.isRunning()) {

Inside, you should have somthing like this:
 * {@inheritDoc}
 * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus,
 *      java.lang.String)
public void logging(IStatus status, String plugin) {
	if (status.getPlugin().startsWith("org.eclipse.acceleo") //$NON-NLS-1$
			|| status.getPlugin().startsWith("org.eclipse.ocl") //$NON-NLS-1$
			|| AcceleoEnginePlugin.PLUGIN_ID.equals(status.getPlugin())) {
		// do something!

And don't forget to remove your listener afterward.
if (Platform.isRunning()) {


Stephane Begaudeau, Obeo

Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: | Eclipse Java Development Tools Tips and Tricks
Previous Topic:NullPointerException
Next Topic:[ACCELEO] maven repo for juno ?
Goto Forum:

Current Time: Wed Jul 06 02:29:35 GMT 2022

Powered by FUDForum. Page generated in 0.02129 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top