You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by Niclas Hedhman <ni...@hedhman.org> on 2017/05/28 04:34:19 UTC

Adding stack trace element ??

Hi,

I am thinking of adding a StackTraceElement in exceptions that indicate
which module the problem is detected in.

WDYT? implementation is not too hard, I think just few lines in
CompositeMethodModel


Cheers
-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Re: Adding stack trace element ??

Posted by Niclas Hedhman <ni...@hedhman.org>.
Not sure that I follow the exact format you intend. I now have


String message = "method " + methodName + " of " + this.toString() + "
in module [" + module.name() + "] of layer [" + module.layer().name()
+ "]";

which gives me something like

Caused by: java.lang.NullPointerException
	at method get of NativeRepositoryService:NativeRepositoryService in
module [RdfIndexing Module] of layer [Infrastructure Layer].(:0)


the this.toString() is the CompositeModel.toString(), which for
ServiceComposites are primaryType:idenity but only primaryType for other
composite meta types.


I am not sure a concise format without telling what each part is, is
particularly friendly for adoption. In the above, I realize that should
probably have quotes around "get", since it otherwise risk to be to obscure.


Niclas

On Sun, May 28, 2017 at 5:19 PM, Paul Merlin <pa...@apache.org> wrote:

> I like the idea.
> I tried to put the trace into IntelliJ stacktrace analyser and it didn't
> choke.
> But we should assert that StackTraceElement[] and Java 9 StackWalker
> don't choke either.
>
> Another thing is that I'll go the other way around when describing where
> the error did happen. From the layer to the method instead, e.g.:
>
> at Infrastructure Layer.DerbySQLStorage
> Module.derbysql-datasource-service.importService(
> DBCPDataSourceServiceImporter:0)
>
> so it looks more like a stacktrace.
>
>
> Niclas Hedhman a écrit :
> > I tried it out and would look like;
> >
> >
> > Caused by: org.apache.polygene.api.service.ServiceImporterException:
> > org.apache.polygene.api.constraint.ConstraintViolationException:
> > Constraint violation in
> > ds-derbysql.[DataSourceConfiguration,EntityComposite] for method
> > 'driver' with constraint "not optional(driver)", for value 'null'
> >       at method importService of
> > DBCPDataSourceServiceImporter:derbysql-datasource-service() in module
> > DerbySQLStorage Module' of layer 'Infrastructure Layer'.(:0)
> >       at org.apache.polygene.library.sql.datasource.
> AbstractDataSourceServiceImporterMixin.importService(
> AbstractDataSourceServiceImporterMixin.java:95)
> >       at org.apache.polygene.library.sql.datasource.
> AbstractDataSourceServiceImporterMixin.importService(
> AbstractDataSourceServiceImporterMixin.java:46)
> >
> >
> > The (:0) at end of line is remnants of line number in "normal" stack
> trace
> > elements.
> >
> >
> > Cheers
> >
> > On Sun, May 28, 2017 at 12:34 PM, Niclas Hedhman <ni...@hedhman.org>
> wrote:
> >
> >> Hi,
> >>
> >> I am thinking of adding a StackTraceElement in exceptions that indicate
> >> which module the problem is detected in.
> >>
> >> WDYT? implementation is not too hard, I think just few lines in
> >> CompositeMethodModel
> >>
> >>
> >> Cheers
> >> --
> >> Niclas Hedhman, Software Developer
> >> http://polygene.apache.org - New Energy for Java
> >>
> >
> >
> >
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Re: Adding stack trace element ??

Posted by Paul Merlin <pa...@apache.org>.
I like the idea.
I tried to put the trace into IntelliJ stacktrace analyser and it didn't
choke.
But we should assert that StackTraceElement[] and Java 9 StackWalker
don't choke either.

Another thing is that I'll go the other way around when describing where
the error did happen. From the layer to the method instead, e.g.:

at Infrastructure Layer.DerbySQLStorage
Module.derbysql-datasource-service.importService(DBCPDataSourceServiceImporter:0)

so it looks more like a stacktrace.


Niclas Hedhman a écrit :
> I tried it out and would look like;
>
>
> Caused by: org.apache.polygene.api.service.ServiceImporterException:
> org.apache.polygene.api.constraint.ConstraintViolationException:
> Constraint violation in
> ds-derbysql.[DataSourceConfiguration,EntityComposite] for method
> 'driver' with constraint "not optional(driver)", for value 'null'
> 	at method importService of
> DBCPDataSourceServiceImporter:derbysql-datasource-service() in module
> DerbySQLStorage Module' of layer 'Infrastructure Layer'.(:0)
> 	at org.apache.polygene.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:95)
> 	at org.apache.polygene.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:46)
>
>
> The (:0) at end of line is remnants of line number in "normal" stack trace
> elements.
>
>
> Cheers
>
> On Sun, May 28, 2017 at 12:34 PM, Niclas Hedhman <ni...@hedhman.org> wrote:
>
>> Hi,
>>
>> I am thinking of adding a StackTraceElement in exceptions that indicate
>> which module the problem is detected in.
>>
>> WDYT? implementation is not too hard, I think just few lines in
>> CompositeMethodModel
>>
>>
>> Cheers
>> --
>> Niclas Hedhman, Software Developer
>> http://polygene.apache.org - New Energy for Java
>>
>
>
>

Re: Adding stack trace element ??

Posted by Niclas Hedhman <ni...@hedhman.org>.
I tried it out and would look like;


Caused by: org.apache.polygene.api.service.ServiceImporterException:
org.apache.polygene.api.constraint.ConstraintViolationException:
Constraint violation in
ds-derbysql.[DataSourceConfiguration,EntityComposite] for method
'driver' with constraint "not optional(driver)", for value 'null'
	at method importService of
DBCPDataSourceServiceImporter:derbysql-datasource-service() in module
DerbySQLStorage Module' of layer 'Infrastructure Layer'.(:0)
	at org.apache.polygene.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:95)
	at org.apache.polygene.library.sql.datasource.AbstractDataSourceServiceImporterMixin.importService(AbstractDataSourceServiceImporterMixin.java:46)


The (:0) at end of line is remnants of line number in "normal" stack trace
elements.


Cheers

On Sun, May 28, 2017 at 12:34 PM, Niclas Hedhman <ni...@hedhman.org> wrote:

> Hi,
>
> I am thinking of adding a StackTraceElement in exceptions that indicate
> which module the problem is detected in.
>
> WDYT? implementation is not too hard, I think just few lines in
> CompositeMethodModel
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://polygene.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java