File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
core/src/main/scala/org/apache/spark/status/api/v1 Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -140,3 +140,16 @@ private[v1] class NotFoundException(msg: String) extends WebApplicationException
140140 .entity(msg)
141141 .build()
142142)
143+
144+ private [v1] class BadParameterException (msg : String ) extends WebApplicationException (
145+ new IllegalArgumentException (msg),
146+ Response
147+ .status(Response .Status .BAD_REQUEST )
148+ .entity(msg)
149+ .build()
150+ ) {
151+ def this (param : String , exp : String , actual : String ) = {
152+ this (" Bad value for parameter \" " + param + " \" . Expected a " + exp + " , got \" " +
153+ actual + " \" " )
154+ }
155+ }
Original file line number Diff line number Diff line change @@ -80,9 +80,14 @@ private[v1] class OneStageResource(uiRoot: UIRoot) {
8080 stageInfo.stageId + " :" + stageInfo.attemptId)
8181 )
8282 }
83- // TODO error handling
84- val quantiles = quantileString.split(" ," ).map{_.toDouble}
85- println(" quantiles = " + quantiles.mkString(" ," ))
83+ val quantiles = quantileString.split(" ," ).map{s =>
84+ try {
85+ s.toDouble
86+ } catch {
87+ case nfe : NumberFormatException =>
88+ throw new BadParameterException (" quantiles" , " double" , s)
89+ }
90+ }
8691 AllStagesResource .taskMetricDistributions(stageUiData.taskData.values, quantiles)
8792 }
8893 }
You can’t perform that action at this time.
0 commit comments