uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Add a way to simply raise an exception message #694

Closed flbulgarelli closed 8 years ago

flbulgarelli commented 8 years ago

When teaching about exceptions, I want to avoid talking about exception classes and exception objects head-first, at least until the bubbling mechanism has being understood.

I'd like to have a language feature, or simply a method in object that allows you to raise an Exception given a message, similar to what assert.fail does. For example:

raise("not enough energy!")
javierfernandes commented 8 years ago

Yes, there is a method in Object class for that.

https://github.com/uqbar-project/wollok/blob/master/org.uqbar.project.wollok.lib/src/wollok.wlk

method error(message) { throw new Exception(message) }

On Wed, Jun 8, 2016 at 4:57 AM, Franco Leonardo Bulgarelli < notifications@github.com> wrote:

When teaching about exceptions, I want to avoid talking about exception classes and exception objects head-first, at least until the bubbling mechanism has being understood.

I'd like to have a language feature, or simply a method in object that allows you to raise an Exception given a message, similar to what assert.fail does. For example:

raise("not enough energy!")

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/694, or mute the thread https://github.com/notifications/unsubscribe/AEORWOdA75ieFxxL0iJhDtEre_wFN19Bks5qJi-kgaJpZM4IwjN_ .

flbulgarelli commented 8 years ago

Nice. Closing

flbulgarelli commented 8 years ago

Hm, wait.

It is not behaving exactly as expected. I will open a different ticket for it