Repository: incubator-s2graph
Updated Branches:
  refs/heads/master 5ccfa2821 -> cdcc0769f


[S2GRAPH-39]: Better exception message on converting between Json and InnerVal.

  think this is more clear exception message

JIRA:
  [S2GRAPH-39] https://issues.apache.org/jira/browse/S2GRAPH-39

Pull Request:
  Closes #22


Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/cdcc0769
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/cdcc0769
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/cdcc0769

Branch: refs/heads/master
Commit: cdcc0769fddccb1d63958f9a7485d87613241546
Parents: 5ccfa28
Author: DO YUNG YOON <[email protected]>
Authored: Tue Feb 23 16:39:24 2016 +0900
Committer: DO YUNG YOON <[email protected]>
Committed: Tue Feb 23 16:39:24 2016 +0900

----------------------------------------------------------------------
 CHANGES                                                  |  2 ++
 .../main/scala/com/kakao/s2graph/core/JSONParser.scala   | 11 +++++------
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/cdcc0769/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bc4c9ec..e53d7a6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,8 @@ Release 0.12.1 - unreleased
 
     S2GRAPH-37: Extract LockExpireDuration as configuration (Committed by 
DOYUNG YOON).
 
+    S2GRAPH-39: Better exception message on converting between Json and 
InnerVal (Committed by DOYUNG YOON).
+
   BUG FIXES
 
     S2GRAPH-18: Query Option "interval" is Broken. 

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/cdcc0769/s2core/src/main/scala/com/kakao/s2graph/core/JSONParser.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/com/kakao/s2graph/core/JSONParser.scala 
b/s2core/src/main/scala/com/kakao/s2graph/core/JSONParser.scala
index 3b6d529..9663f69 100644
--- a/s2core/src/main/scala/com/kakao/s2graph/core/JSONParser.scala
+++ b/s2core/src/main/scala/com/kakao/s2graph/core/JSONParser.scala
@@ -31,7 +31,7 @@ trait JSONParser {
                 case InnerVal.LONG => JsNumber(d.toLong)
                 case InnerVal.FLOAT => JsNumber(d.toDouble)
                 case InnerVal.DOUBLE => JsNumber(d.toDouble)
-                case _ => throw new RuntimeException("innerValToJsValue 
invalid")
+                case _ => throw new RuntimeException(s"$innerVal, $dType => 
$dataType")
               }
             case num: BigDecimal =>
               //              JsNumber(num)
@@ -43,19 +43,18 @@ trait JSONParser {
                 case InnerVal.LONG => JsNumber(num.toLong)
                 case InnerVal.FLOAT => JsNumber(num.toDouble)
                 case InnerVal.DOUBLE => JsNumber(num.toDouble)
-                case _ => throw new RuntimeException("innerValToJsValue 
invalid")
+                case _ => throw new RuntimeException(s"$innerVal, $dType => 
$dataType")
               }
             //              JsNumber(num.toLong)
-            case _ => throw new RuntimeException("innerValToJsValue invalid")
+            case _ => throw new RuntimeException(s"$innerVal, Numeric Unknown 
=> $dataType")
           }
         //          
JsNumber(InnerVal.scaleNumber(innerVal.asInstanceOf[BigDecimal], dType))
-        case _ =>
-          throw new RuntimeException(s"innerVal $innerVal to JsValue with type 
$dType")
+        case _ => throw new RuntimeException(s"$innerVal, Unknown => 
$dataType")
       }
       Some(jsValue)
     } catch {
       case e: Exception =>
-        logger.info(s"JSONParser.innerValToJsValue: $innerVal, $dataType")
+        logger.info(s"JSONParser.innerValToJsValue: $e")
         None
     }
   }

Reply via email to