You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/03/01 15:43:00 UTC
[jira] [Commented] (GORA-530) Reinstate exception throwing at
Query#execute()
[ https://issues.apache.org/jira/browse/GORA-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16382186#comment-16382186 ]
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_r171598778
--- 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, Nishadi.
I have been thinking about this. You asked because in the case the is only a log and a throw? I actually just enclosed with try-catch whatever existed before without thinking much about it. But if you are saying that we should only throw the exceptions without logging -since we are not logging anything interesting-, then I guess you are right. I could have done that, but I just did not want to change much the existing datastores :P My fault. It would be good just throw the exceptions and nothing more.
I will see about changing it whenever I have the time and energy :) Or if anyone wants to change it...
Thanks!
> 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)