reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Dudoladov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (REEF-1276) Improve error message shown when injectable class has [Parameter] annotation
Date Tue, 29 Mar 2016 08:34:25 GMT

    [ https://issues.apache.org/jira/browse/REEF-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15215683#comment-15215683
] 

Sergey Dudoladov commented on REEF-1276:
----------------------------------------

It looks like the line 170 in {{ClassHierarchyImpl}} causes it :

{code}
INamedParameterNode np = (INamedParameterNode)RegisterType(constructorArg.GetNamedParameterName());
{code}

I can move the line to the try-catch statement udnerneath and  then catch and re-throw the
{{InvalidCastException}} with a more meaningful message.

Will it help ?

> Improve error message shown when injectable class has [Parameter] annotation
> ----------------------------------------------------------------------------
>
>                 Key: REEF-1276
>                 URL: https://issues.apache.org/jira/browse/REEF-1276
>             Project: REEF
>          Issue Type: Improvement
>          Components: Tang.NET
>            Reporter: Mariia Mykhailova
>            Assignee: Sergey Dudoladov
>            Priority: Minor
>
> {noformat}
>         [Inject]
>         private PoisonedEventHandler(
>             [Parameter(typeof(CrashProbability))] double crashProbability,
>             [Parameter(typeof(CrashTimeout))] int crashTimeout,
>             [Parameter(typeof(RuntimeClock))] RuntimeClock clock) 
>         {
>             ...
>         }
> {noformat}
> This code produces runtime error because {{RuntimeClock}} is not a primitive type and
thus doesn't need an annotation. The error message is
> {noformat}
> ERROR: Exception in Call_clrSystemAllocatedEvaluatorHandler_OnNext:encountered error
[System.InvalidCastException: Unable to cast object of type 'Org.Apache.REEF.Tang.Implementations.ClassHierarchy.ClassNodeImpl'
to type 'Org.Apache.REEF.Tang.Types.INamedParameterNode'.
>    at Org.Apache.REEF.Tang.Implementations.ClassHierarchy.ClassHierarchyImpl.RegisterType(Type
type)
>    at Org.Apache.REEF.Tang.Implementations.ClassHierarchy.ClassHierarchyImpl.GetNode(Type
type)
>    at Org.Apache.REEF.Tang.Implementations.Configuration.CsConfigurationBuilderImpl.GetNode(Type
c)
>    at Org.Apache.REEF.Tang.Implementations.Configuration.CsConfigurationBuilderImpl.Org.Apache.REEF.Tang.Interface.ICsInternalConfigurationBuilder.BindSetEntry(Type
iface, Type impl)
>    at Org.Apache.REEF.Tang.Formats.ConfigurationModule.Build()
>    at Org.Apache.REEF.Tests.Functional.FaultTolerant.PoisonTest.PoisonedEvaluatorDriver.OnNext(IAllocatedEvaluator
value)
> {noformat}
> It would be very nice to have something easier understandable, for example "Cannot interpret
RuntimeClock as named parameter". Currently it takes a long time to figure out what exactly
is wrong.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message