terraframe/common-geo-registry-adapter

Throwable exceptions not declared in method signatures

Closed this issue · 6 comments

I am going to start documenting where we should probably throw exceptions:

  • In the Attribute.java type hierarchy, an invalid value exception needs to be thrown for the method:
    public void fromJSON(JsonElement jValue, RegistryAdapter registry)

  • AttributeTerm - Throw exception when termCode is not valid
    public void setTermCode(String termCode)
    public void addTerm(String termCode)

Question: is it sufficient to have some kind of InvalidValue exception or should we subclass that with additional exceptions for the specific attribute types? I would think an exception on an AttributeTerm could have some additional accessor methods that would return some information on the term that is invalid. Let me think about that.

@nmceachen

is it sufficient to have some kind of InvalidValue exception

Yes, I think that an InvalidvalueException would be OK

InvalidLoginException
SessionTimeoutException
RunwayExceptionDTO (DataNotFoundException) (on client.getGeoObjectByCode)

Ephraim would like to have checked java exceptions so that he knows when a exception may be expected and when he should have a try/catch.

I will add the following checked exceptions to most calls to the server:

  1. AuthenticationException - Invalid user credentials
  2. ServerResponseException - Server responded with an error to a request
  3. IOException - Error occurred when trying to communicate with the server

Fixed in version 0.3.3