package Ġcom . nim ble . nim b ler ew ards . use cases Ċ Ċ import Ġcom . nim ble . nim b ler ew ards . data . exceptions . App Error Ċ import Ġio . reactivex . Single Ċ Ċ abstract Ġclass ĠUse Case < T , Ġin ĠParams >( ĊĠĠĠ Ġprivate Ġval Ġexecution Thread : ĠRx Scheduler , ĊĠĠĠ Ġprivate Ġval Ġpost Execution Thread : ĠRx Scheduler Ċ ) Ġ{ ĊĊĠĠĠ Ġprotected Ġabstract Ġfun Ġcreate ( params : ĠParams ): ĠSingle < T > ĊĊĠĠĠ Ġprotected Ġabstract Ġfun Ġconvert Error ( throwable : ĠThrowable ): Ġ( Throwable ) Ġ-> ĠApp Error ĊĊĠĠĠ Ġfun Ġexecute ( params : ĠParams ): ĠSingle < T > Ġ= Ġcreate ( params ) ĊĠĠĠĠĠĠĠ Ġ. onError Resume Next Ġ{ ĠSingle . error < T >( convert Error ( it )( it )) Ġ} ĊĠĠĠĠĠĠĠ Ġ. do OnError (:: do OnError ) ĊĠĠĠĠĠĠĠ Ġ. subscribe On ( execution Thread . get ()) ĊĠĠĠĠĠĠĠ Ġ. observe On ( post Execution Thread . get ()) ĊĊĠĠĠ Ġprivate Ġfun Ġdo OnError ( throwable : ĠThrowable ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠCrash ly t ics . log ( throwable ) ĊĠĠĠĠĠĠĠ Ġthrowable . printStackTrace () ĊĠĠĠ Ġ} Ċ } Ċ