From 1a9b2ef5319266b4ce37fa6f4f373a889e6f7647 Mon Sep 17 00:00:00 2001 From: DO YUNG YOON Date: Fri, 19 Feb 2016 17:04:02 +0900 Subject: [PATCH] S2GRAPH-39 Better exception message on converting between Json and InnerVal. --- .../scala/com/kakao/s2graph/core/JSONParser.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 3b6d5299..9663f692 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 } }