Exceptions - reverting all changes - is this possible?

koeppelmannkoeppelmann Member Posts: 51
From time to time I have the situation that it would be very useful that you could raise an exception that reverts all interaction.

Lets say we have an array with payments that should be done and I have a total sum of money available for this money. Of course I could first check that the total of all payments is <= the available money. However - I would like to just go over the array - do the payment and sum up the payed amounts. If I notice it runs out of money I would like to trough an exception.

The way it could be done today would be: if the condition for the exception is met that just start and endless loop - so that the execution will run out of gas (and everything will be reverted) Obviously that is a very dirty solution.

Are such exceptions planned to come? Otherwise I guess we would indeed do the "dirty solution".

Comments

Sign In or Register to comment.