Arc - Inconsistent error notification when invoked via fluent function calls vs invoking with data
saumyatripathi opened this issue · 1 comments
Hello contributors. Thank you for building and maintaining this amazing set of tools.
I may have found an inconsistency (and thought it might be helpful if recorded here) with how the error is reported when the .innerRadius
is not supplied to the arc function when invoked in the below two ways -
d3Shape .arc() .innerRadius(0) .outerRadius(50) .startAngle(Math.PI / 2) .endAngle(Math.PI * 2)()
If the.innerRadius(0)
is skipped, the below error is received -
TypeError: undefined is not an object (evaluating 'd.innerRadius')
d3Shape.arc().innerRadius(0).outerRadius(50)({ startAngle: 0, endAngle: Math.PI / 2, })
while the error thrown when.innerRadius(0)
is skipped with this syntax is -
Invalid number formatting character 'N' (i=44. s=M3...
some numbers
...NaN, NaNZ)
As seen above, while 1 is pretty clear, 2 does not really indicate the real issue. I spent a fair amount of time trying to narrow it down.
Best
Thanks for the feedback, @saumyatripathi. We don’t plan on fixing this; many graphics APIs (such as Canvas) will ignore invalid input rather than throwing an error. Your browser will often log warnings with invalid SVG path strings that you can then investigate.