arosien commented on code in PR #935:
URL: https://github.com/apache/daffodil-vscode/pull/935#discussion_r1449516166


##########
debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala:
##########
@@ -472,6 +492,28 @@ object Parse {
           }
       }
 
+    // Parse the root name field from the launch config
+    // Defaults to None
+    //
+    // arguments: Launch config
+    def parseRootName(arguments: JsonObject) =
+      Option(arguments.getAsJsonPrimitive("rootName"))
+        .map(_.getAsString())
+        .getOrElse("")
+        .asRight[String]
+        .toEitherNel

Review Comment:
   This doesn't actually default to `None`, it defaults to `""`, which I think 
we should avoid. Instead we can return an `Either[String, Option[String]]` and 
pass that along, so downstream code doesn't have to check for the empty string. 
Something like:
   ```suggestion
       // Defaults to None
       //
       // arguments: Launch config
       def parseRootName(arguments: JsonObject): Either[String, Option[String]] 
=
         Right(
           Option(arguments.getAsJsonPrimitive("rootName"))
             .map(_.getAsString())
         ).toEitherNel
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to