Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » How to generate a runtime exception
How to generate a runtime exception [message #839988] Mon, 09 April 2012 14:17 Go to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
What is the proper way, using EGL, to generate an exception/error/warning?

For example, when I am processing my model and I conclude that there is something missing/broken in the user model: I would like to generate an error which can be picked up by the invoking Java code (and shown to the user).
Re: How to generate a runtime exception [message #839993 is a reply to message #839988] Mon, 09 April 2012 14:26 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Maarten,

You can use the throw statement followed by a string that provides a description of the exception. e.g.

if (somethingIsMissing) {
throw "Something is missing";
}

Another alternative - which I suspect I'd probably go for - would be to use a set of EVL constraints to check that your model is correct/complete before running the model-to-text transformation so that you eliminate the need for runtime exceptions.

Cheers,
Dimitris
Re: How to generate a runtime exception [message #840000 is a reply to message #839993] Mon, 09 April 2012 14:36 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Thank you for your quick reply!

I'll try out the throw statement for now, as I do not have EVL constraints set up. But I agree that would be nicer indeed.

Note: I cannot find any reference to the throw statement in the Epsilon book (I looked in it as I suspected something like this would be available). Should I add a bug for this? Or is the book 'unsupported'? Smile
Re: How to generate a runtime exception [message #842522 is a reply to message #840000] Thu, 12 April 2012 11:25 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Yes, please file a bug report for that. We try to keep the book in sync with the code as much as possible Smile.
Re: How to generate a runtime exception [message #843772 is a reply to message #842522] Fri, 13 April 2012 10:55 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Filed the bug report #376706 (sorry, I (still) cannot use links...)
Re: How to generate a runtime exception [message #859323 is a reply to message #843772] Fri, 27 April 2012 15:21 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Thanks for your report! I updated the EOL chapter of the book, so it should be fine now Smile.
Previous Topic:Using ETL transform models which are based on UML Profiles
Next Topic:Runtime Source Code for Epsilon - Bug 344452 - Add yourself to CC to show support
Goto Forum:
  


Current Time: Thu Mar 28 08:14:45 GMT 2024

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

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

Back to the top