You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Prescott <mi...@gmail.com> on 2013/04/20 18:43:46 UTC

Helpfulness of errors for missing @Symbols

I'm using Symbols injected into my app's tapestry module to read web
context init parameters.

class MyModule {
   @Inject
   @Symbol("myapp.hairinesslevel")
   private int hairinessLevel;
}

I run the app in a bunch of different ways - in jetty:run, deployed as a
service, and in a web container, so occasionally I forget to define a
symbol.

Unfortunately, that tends to result in a very hard to read error about
recursion in the definition of 'ApplicationDefaults'.

Is there some canonical approach for injecting symbol that produces cleaner
error messages when the symbol is undefined?

Gratefully,

Michael

Re: Helpfulness of errors for missing @Symbols

Posted by Nicolas Barrera <nb...@gmail.com>.
I agree it's a very odd error report,

I 'd just like to add that you could protect your hairiness level
contributing to the factory default defaults service, there you can define
factory defaults to symbols which in some cases saves you from crashing in
that way.

Of course there 're some situations a default value is not an option so I
'm happy Howard also agrees to change the error reporting in these cases...
but anyway that's my two cents. (by the way it would be great to have a
default value for hairiness set to false!)


Nicolás.-


On Sat, Apr 20, 2013 at 1:43 PM, Michael Prescott <
michael.r.prescott@gmail.com> wrote:

> I'm using Symbols injected into my app's tapestry module to read web
> context init parameters.
>
> class MyModule {
>    @Inject
>    @Symbol("myapp.hairinesslevel")
>    private int hairinessLevel;
> }
>
> I run the app in a bunch of different ways - in jetty:run, deployed as a
> service, and in a web container, so occasionally I forget to define a
> symbol.
>
> Unfortunately, that tends to result in a very hard to read error about
> recursion in the definition of 'ApplicationDefaults'.
>
> Is there some canonical approach for injecting symbol that produces cleaner
> error messages when the symbol is undefined?
>
> Gratefully,
>
> Michael
>

Re: Helpfulness of errors for missing @Symbols

Posted by Howard Lewis Ship <hl...@gmail.com>.
That's a very odd error to get for a symbol without a definition, and I'd
call that a bug. It's supposed to be a very clear error that "foo" is not
defined.


On Sat, Apr 20, 2013 at 5:43 PM, Michael Prescott <
michael.r.prescott@gmail.com> wrote:

> I'm using Symbols injected into my app's tapestry module to read web
> context init parameters.
>
> class MyModule {
>    @Inject
>    @Symbol("myapp.hairinesslevel")
>    private int hairinessLevel;
> }
>
> I run the app in a bunch of different ways - in jetty:run, deployed as a
> service, and in a web container, so occasionally I forget to define a
> symbol.
>
> Unfortunately, that tends to result in a very hard to read error about
> recursion in the definition of 'ApplicationDefaults'.
>
> Is there some canonical approach for injecting symbol that produces cleaner
> error messages when the symbol is undefined?
>
> Gratefully,
>
> Michael
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com