As per my knowledge,there are no custom exceptions in solidity. The only exception is Out of Gas. Wherever we write throw in contract code, it throws out-of-gas exception.
But, is there any way I can catch that exception? I mean if I can execute a piece of code whenever an exception occurs? Even on working with geth console, I didn't get any notification that whether any exception occurred.
I think it's pretty possible to catch such exception, because Mist is able to display Intrinsic gas too low error message, whenever an exception occurred, so it must have handled that exception somewhere.
Edit:
Basically the question is:
How can we know, before sending the transaction, that this transaction will consume all the provided gas?
I am not asking on How can I provide sufficient gas for my transaction but How can I know that my transaction will run out of gas.
One way of doing so is to send the transaction, let it be mined and then check for gasUsed=gasSend, of if there is thow use debug.traceTransaction.
But I want to know whether my transaction will go through or not without sending the transaction. In Mist whenever I try to send a transaction that will encounter a throw statement, It displays Intrinsic gas too low before sending the transaction. I want to do the same from geth.
out-of-gasexception, so that I can display a message like Mist does. – Prashant Prabhakar Singh Sep 19 '16 at 09:59throwan exception, all gas is consumed and hence Mist showsIntrinsic gas too low. But, if you perform the same transaction fromgeth console, the transactions is send, but after mining when you debug it, it will giveinvalid jump destination (PUSH1) 2. What i want is, I can prevent transaction from being send just as Mist does, if there is somewhere exceptions s thrown, or the transaction consumes all gas. – Prashant Prabhakar Singh Sep 19 '16 at 12:01