infinite / mockito-flex

0 stars 0 forks source link

Better error handling in ArgumentSpecifierImpl #28

Closed infinite closed 10 years ago

infinite commented 10 years ago

The ArgumentSpecifierImpl class swallows errors that happen while calling the take() method in the action.

As such you loose track of where the error actually happened and its stacktrace. Very confusing to just see the stacktrace stop at ArgumentSpecifierImpl, lin 71. {{{

!actionscript

public function take(stubbingContext:StubbingContext):void { if (!action) throw new ArgumentActionNotSpecified("Did you forget to specify action for the argument?"); try { action.take(stubbingContext.args[index]); } catch (e:Error) { throw new ArgumentActionFailed("While evaluating argument " + index + " failed to " + action.describe() + " : " + e.message); } } }}}

Therefore I changed ArgumentSpecifierImpl and ArgumentActionFailed to provide a more clear error stacktrace. Have a look at the attachments. Can this be incorporated in the next release?

Thanks!

infinite commented 10 years ago

From loomis on 2010-11-02 13:48:51+00:00

Thanks for the contribution very good improvement!

Per request I added your changes and put a new release 1.4M5.

Let me know if it works as expected.

Regards, Kris