I was able to modify the code and get the tuple in case of Success. How do
I pass the tuple to the Failure part?
try
{
//
//some processing
if (!validationMessages.isEmpty) {
(parsedJson.toString(), validationMessages.foreach(x => {
val msg: String = x.getMessage
m
Thanks, Caizhi for your explanation. It helped me to understand where I
went wrong.
On Thu, Jan 6, 2022 at 7:37 AM Caizhi Weng wrote:
> Hi!
>
> The last expression in your try block is
>
> if(validationMessages.isEmpty) {
> (parsedJson.toString(),
> validationMessages.foreach((msg=>msg.getMess
Hi!
The last expression in your try block is
if(validationMessages.isEmpty) {
(parsedJson.toString(),
validationMessages.foreach((msg=>msg.getMessage.toString)))
} else {
(parsedJson.toString(), "Format is correct...")
}
The first one produces a (String, Unit) type while the second one produ
I have written a process function where I am parsing the JSON and if it is
not according to the expected format it passes as Failure to the process
function and I print the records which are working fine. Now, I was trying
to print the message and the record in case of Success and Failure. I
implem