You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by alfonsonishikawa <gi...@git.apache.org> on 2018/03/01 15:42:46 UTC
[GitHub] gora pull request #127: GORA-530 : Reinstated exception throwing in DataStor...
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!
---