title: suspend in UseCase vs Repository
body: <p>I have a stupid question..... but I cannot find the information.</p>
  <p>I have created a <code>Repository.kt</code> , which using Co-Routine</p>
  <p>The code is as below:</p>
  <pre><code>        override suspend fun getChallenge(): AwsResult&lt;String&gt; {
                  return awsApi.getChallenge()
          }
  </code></pre>
  <p>The AwsAPI part is done as below:</p>
  <pre><code>override suspend fun getChallenge(): AwsResult&lt;String&gt; {
         ....
  
          return withContext(Dispatchers.IO) {
              try {
                  val reponse: ... =&gt; API call through SDK
                  AwsResult.onSuccess(reponse.text)
              } catch (e: Exception) {
                  AwsResult.onError(e)
              }
          }
      }
  </code></pre>
  <p>I have created a <code>ChallengeUseCase.kt</code> which will contain a little buit of logic before sending back the result to the ViewModel.</p>
  <pre><code>     suspend fun registerDevice(): Result&lt;String&gt; {
          try {
              val result = repository.getChallenge()
          } catch (e: Exception) {
  
          }
      }
  </code></pre>
  <p>and the <code>AwsResult</code> looks like:</p>
  <pre><code>sealed class AwsResult&lt;out R&gt; {
      data class onSuccess&lt;out T&gt;(val data: T) : AwsResult&lt;T&gt;()
      data class onError(val exception: Exception) : AwsResult&lt;Nothing&gt;()
  }
  </code></pre>
  <p>I would like to know how do I catch the <code>AwsResult</code> in the use case file ? the goal is to extract an information, do something with it and the sending back to the viewModel the result of the business logic implemented. I assume that <code>result</code> will not contain right away the information and that I have to probably defined a scope or something around that.</p>
  <p>When I say, that I assume that the result will not contain right away the info, it's because I try to catch the <code>onSuccess</code> and <code>onResult</code> in the <code>UseCase.kt</code>.</p>
  <p>Any idea ?</p>