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

Gilles commented on GEOMETRY-8:
-------------------------------

PR merged in commit 2e6fc6a1baaa5f71bd2385e2c6e20f0334b9f2bc on "master".
{quote}combination of JDK exception types for input validation and general 
illegal states and a specialized GeometryException hierarchy
{quote}
Makes sense.
 However I wonder whether it wouldn't be better if the likes of 
{{IllegalNormException}} were kept "internal".
 IOW, is there something more a user can do when the actual exception is part 
of the public API, rather than an instance of {{GeometryException}}?
 If not, I'd suggest having a {{GeometryException}} factory that creates 
instances as appropriate:
{code:java}
public class GeometryException {
    // ...

    public static GeometryException illegalNorm(double norm) {
        return new IllegalNormException(norm);
    }
}

private class IllegalNormException extends GeometryException { /* ... */ }
{code}

> Update Exception Instantiation
> ------------------------------
>
>                 Key: GEOMETRY-8
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-8
>             Project: Apache Commons Geometry
>          Issue Type: Task
>            Reporter: Matt Juntunen
>            Priority: Major
>
> Update exception instantiation following the pattern in commons-numbers, eg. 
> custom private exception types created through factories. See the discussion 
> on GEOMETRY-2 and the GammaException class and its use in LogBeta in 
> commons-numbers. 
>  
> Based on discussion in GEOMETRY-9, we are going to implement our own 
> exception hierarchy for this component, eg GeometryException and subclasses.
>  
> Pull request: [https://github.com/apache/commons-geometry/pull/9]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to