title: Coroutine and Callback handler in kotlin
body: <p>I am currently building an app using AWS SDK. One of the API is a sign in and is requiring, in addition to email and password, a Callback in order to get back the status of the request. The issue is that I am not able to send back the result.</p>
  <p>This is my code:</p>
  <pre><code>
  override suspend fun signIn(email: String, password: String): Result&lt;SignInResult&gt; =
          withContext(ioDispatcher) {
              try {
                  api.signIn(email, password, object : Callback&lt;SignInResult&gt; {
                      override fun onResult(result: SignInResult?) {
                          Result.Success(result!!)
                      }
  
                      override fun onError(e: Exception?) {
                          Result.Error(e!!)
                      }
                  })
              } catch (e: Exception) {
                  Result.Error(e)
              }
          }
  
  
  </code></pre>
  <p>The issue is that coroutine sign in is requiring a return of <code>Result</code> but I do not know what to return because I should only return when <code>onResult</code>, <code>onError</code> and when catching an exception.</p>
  <p>Any idea how to make it works ?</p>
  <p>Thanks</p>