gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GORA-530) Reinstate exception throwing at Query#execute()
Date Tue, 13 Feb 2018 21:57:00 GMT

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

ASF GitHub Bot commented on GORA-530:
-------------------------------------

Github user alfonsonishikawa commented on a diff in the pull request:

    https://github.com/apache/gora/pull/127#discussion_r168014313
  
    --- Diff: gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java
---
    @@ -159,17 +167,25 @@ public boolean schemaExists() {
        * @return the Object corresponding to the key or null if it cannot be found
        */
       @Override
    -  public T get(K key, String[] fields) {
    -
    -    Key recordKey = getAerospikeKey(key);
    -    fields = getFieldsToQuery(fields);
    +  public T get(K key, String[] fields) throws GoraException {
     
    -    Record record = aerospikeClient
    -            .get(aerospikeParameters.getAerospikeMapping().getReadPolicy(), recordKey,
fields);
    -    if (record == null) {
    -      return null;
    +    try {
    +      Key recordKey = getAerospikeKey(key);
    +      fields = getFieldsToQuery(fields);
    +  
    +      Record record = aerospikeClient
    +              .get(aerospikeParameters.getAerospikeMapping().getReadPolicy(), recordKey,
fields);
    +      
    +      if (record == null) {
    +        return null;
    +      }
    +      return createPersistentInstance(record, fields);
    +    } catch (GoraException e) {
    +      throw e;
    --- End diff --
    
    Hi! Yes. Notice that createPersistentInstance has been updated to throw GoraException.
Throughout the changes, GoraException is being used as a simple wrapper to have a common interface
for all datastores, so as you can see two lines bellow in this diff, any exception (not GoraException)
is logged and wrapped. In the case of a catch of a GoraException we can safely assume that
it is already logged and wraping other exception (or maybe an actual GoraException but this
does not make difference) and we wouldn't want to wrap it again because that would be useless
and would hide the exception's parent exception in an indefinite sequence.
    Maybe it is not the best solution, but I didn't get to any better. If you have any suggestion
it will be welcome!


> Reinstate exception throwing at Query#execute()
> -----------------------------------------------
>
>                 Key: GORA-530
>                 URL: https://issues.apache.org/jira/browse/GORA-530
>             Project: Apache Gora
>          Issue Type: Improvement
>          Components: gora-core
>    Affects Versions: 0.8
>            Reporter: Alfonso Nishikawa
>            Assignee: Alfonso Nishikawa
>            Priority: Minor
>              Labels: query
>             Fix For: 0.9
>
>
> When executing a query, the exceptions are being shadowed and the execution returns {{null}}.
> This makes any client to be ignorant of the cause, because it is only logged into the
server.
> The objective is to reinstate the exception throwing, where the interface throws GoraException
to make any client aware of the underlying problem.



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

Mime
View raw message