Skip to content

Instantly share code, notes, and snippets.

View mkoslacz's full-sized avatar

Mateusz Koślacz mkoslacz

View GitHub Profile
@mkoslacz
mkoslacz / RxJava2DebugStackOverflow.kt
Created January 12, 2018 15:58
RxJava2Debug causing StackOverflowError on too complex CompositeException
@RunWith(AndroidJUnit4::class)
class RxJava2DebugStackOverflowTest {
@Test
fun errorReportedCorrectlyWithoutRxJava2Debug() {
RxJava2Debug.disableRxJava2AssemblyTracking()
var i = 1
Observable.just(1)
.doOnNext { throw Exception("source exception") }
.doOnError { throw Exception("in chain exception ${i++}") }
@mkoslacz
mkoslacz / MalfunctioningTransactionUsecase.kt
Created January 12, 2018 14:23
Sample malfunctioning transaction usecase
fun <T : Any> Observable<List<T>>.replaceInLocalRepo(localRepository: Repository<T>,
localSpecification: Specification): Observable<List<T>> =
this.flatMapSingle { incomingEntities ->
runInTransactionSingle {
incomingEntities
.asSingle()
.flatMap {
localRepository
.remove(localSpecification)
@mkoslacz
mkoslacz / TraceurStackOverflow.kt
Last active July 1, 2017 12:54
Traceur causing StackOverflowError on too complex CompositeException
@RunWith(AndroidJUnit4::class)
class TraceurStackOverflowTest {
@Test
fun errorReportedCorrectlyWithoutTraceur() {
Traceur.disableLogging()
var i = 1
Observable.just(1)
.doOnNext { throw Exception("source exception") }
.doOnError { throw Exception("in chain exception ${i++}") }
@mkoslacz
mkoslacz / TraceurRetryFailureShowcase.kt
Created April 6, 2017 13:06
Traceur fails when using retry
class TraceurRetryFailureShowcase {
@Test
fun usingRetryWithTraceurFails() {
Traceur.enableLogging()
val publishSubject = PublishSubject.create<Int>()
val errors = mutableListOf<Throwable>()