title: How to return custom class Object in Rx Android
body: <p>I'm able to return boolean value when I get exception here in below method as:</p>
  <pre><code>private fun verifyCase(str: String): Single&lt;Boolean&gt; {
      return matchCase(str)
          .ensure(CasesException()) { it }
          .onErrorResumeNext { false.toSingle() }
  }
  </code></pre>
  <p>But now I need to update boolean value with the cause of <code>Throwable</code> and I'm unable to do because I'm new for <code>RxJava</code>. Please guide me if I'm doing anything wrong.</p>
  <p>Created a custom entity as:</p>
  <pre><code>class VerificationResult(status: Int, message: String) : Throwable(message) {
  }
  </code></pre>
  <p>And updated above function which is still asking me to change the return type of fun as</p>
  <pre><code> private fun verifyCase(str: String): Single&lt;VerificationResult&gt; {
      return matchCase(str)
          .ensure(CasesException()) { it }
          .onErrorResumeNext { false.toSingle() }
          .onErrorReturn { throwable -&gt; VerificationResult(false, throwable.printStackTrace()) }
  }
  </code></pre>