Skip to main content



      Home
Home » Modeling » Epsilon » How to generate a runtime exception
How to generate a runtime exception [message #839988] Mon, 09 April 2012 10:17 Go to next message
Eclipse UserFriend
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 10:26 Go to previous messageGo to next message
Eclipse UserFriend
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 10:36 Go to previous messageGo to next message
Eclipse UserFriend
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 07:25 Go to previous messageGo to next message
Eclipse UserFriend
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 06:55 Go to previous messageGo to next message
Eclipse UserFriend
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 11:21 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 13:29:33 EDT 2025

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

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

Back to the top