 <p>First, to specify <code>E</code> explictly, you could use the more verbose lambda syntax. This would look like this:</p> <pre><code>myObservable.handleError { it : IOException -&gt; it.printStackTrace() } </code></pre> <p>Alternativly, you could add an additional parameter to help the compiler infer the type. This could look something like this:</p> <pre><code>public inline fun &lt;reified E : Throwable, R&gt; Observable&lt;R&gt;.handleError( typeHint: (E) -&gt; Unit, crossinline handler: (E) -&gt; Unit ) = onErrorResumeNext f@{ return@f when (e) { is E -&gt; { handler(e); Observable.empty() } else -&gt; Observable.error(e) } } fun &lt;T&gt; of() : (T) -&gt; Unit = {} </code></pre> <p>Usage:</p> <pre><code>myObservable.handleError(of&lt;IOException&gt;()) { it.printStackTrace() } </code></pre>