Log error from children

Report a typo

We have an API for loading data from a server, and we need to add logging to the server so that later we can analyze errors.

Your task is to modify the main scope so that errors from all children async tasks get logged in the following format: Error: ${exception.message}.

Tip: Each exception has a property .message.

Write a program in Kotlin
// Define a proper scope here
// Don't ignore the error only log them
// val mainScope =

suspend fun main() {
// we load data in the main scope
// make the scope log errors thrown by `loadData`
// no need to modify this code
mainScope.loadData("http://url1").join()
mainScope.loadData("http://url2").join()
}
___

Create a free account to access the full topic