@@ -42,7 +42,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
4242 CACHE_AND_REMOTE -> applyCacheAndRemote(block)
4343 MEMORY_ELSE_CACHE_AND_REMOTE -> {
4444 if (memoryCacheSource != null ) {
45- ignoreSourceException {
45+ ignoreException {
4646 send(block(memoryCacheSource as SOURCE ))
4747 return @produce
4848 }
@@ -55,10 +55,10 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
5555
5656
5757 private suspend fun <R > ProducerScope<R>.applyOnlyRemote (block : suspend SOURCE .() -> R ) {
58- var remoteException: AppException ? = null
58+ var remoteException: Exception ? = null
5959
6060 if (remoteSource != null ) {
61- remoteException = ignoreSourceException {
61+ remoteException = ignoreException {
6262 val result = block(remoteSource)
6363 send(result)
6464 memoryCacheSource?.update(result)
@@ -68,7 +68,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
6868 }
6969
7070 if (defaultSource != null ) {
71- ignoreSourceException {
71+ ignoreException {
7272 return send(block(defaultSource))
7373 }
7474 }
@@ -82,14 +82,14 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
8282
8383 private suspend fun <R > ProducerScope<R>.applyOnlyCache (block : suspend SOURCE .() -> R ) {
8484 if (memoryCacheSource != null ) {
85- ignoreSourceException {
85+ ignoreException {
8686 send(block(memoryCacheSource as SOURCE ))
8787 return
8888 }
8989 }
9090
9191 if (fileCacheSource != null ) {
92- ignoreSourceException {
92+ ignoreException {
9393 val result = block(fileCacheSource as SOURCE )
9494 send(result)
9595 memoryCacheSource?.update(result)
@@ -98,7 +98,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
9898 }
9999
100100 if (defaultSource != null ) {
101- ignoreSourceException {
101+ ignoreException {
102102 return send(block(defaultSource))
103103 }
104104 }
@@ -107,9 +107,9 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
107107 }
108108
109109 private suspend fun <R > ProducerScope<R>.applyRemoteElseCache (block : suspend SOURCE .() -> R ) {
110- var remoteException: AppException ? = null
110+ var remoteException: Exception ? = null
111111 if (remoteSource != null ) {
112- remoteException = ignoreSourceException {
112+ remoteException = ignoreException {
113113 val result = block(remoteSource)
114114 send(result)
115115 memoryCacheSource?.update(result)
@@ -119,14 +119,14 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
119119 }
120120
121121 if (memoryCacheSource != null ) {
122- ignoreSourceException {
122+ ignoreException {
123123 send(block(memoryCacheSource as SOURCE ))
124124 return
125125 }
126126 }
127127
128128 if (fileCacheSource != null ) {
129- ignoreSourceException {
129+ ignoreException {
130130 val result = block(fileCacheSource as SOURCE )
131131 send(result)
132132 memoryCacheSource?.update(result)
@@ -135,7 +135,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
135135 }
136136
137137 if (defaultSource != null ) {
138- ignoreSourceException {
138+ ignoreException {
139139 return send(block(defaultSource))
140140 }
141141 }
@@ -145,25 +145,25 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
145145
146146 private suspend fun <R > ProducerScope<R>.applyCacheElseRemote (block : suspend SOURCE .() -> R ) {
147147 if (memoryCacheSource != null ) {
148- ignoreSourceException {
148+ ignoreException {
149149 send(block(memoryCacheSource as SOURCE ))
150150 return
151151 }
152152 }
153153
154154 if (fileCacheSource != null ) {
155- ignoreSourceException {
155+ ignoreException {
156156 val result = block(fileCacheSource as SOURCE )
157157 send(result)
158158 memoryCacheSource?.update(result)
159159 return
160160 }
161161 }
162162
163- var remoteException: AppException ? = null
163+ var remoteException: Exception ? = null
164164
165165 if (remoteSource != null ) {
166- remoteException = ignoreSourceException {
166+ remoteException = ignoreException {
167167 val result = block(remoteSource)
168168 send(result)
169169 memoryCacheSource?.update(result)
@@ -173,7 +173,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
173173 }
174174
175175 if (defaultSource != null ) {
176- ignoreSourceException {
176+ ignoreException {
177177 return send(block(defaultSource))
178178 }
179179 }
@@ -188,7 +188,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
188188 private suspend fun <R > ProducerScope<R>.applyCacheAndRemote (block : suspend SOURCE .() -> R ) {
189189 val cacheReturnDeferred = async {
190190 if (memoryCacheSource != null ) {
191- ignoreSourceException {
191+ ignoreException {
192192 val result = block(memoryCacheSource as SOURCE )
193193
194194 if (isActive && ! isClosedForSend) {
@@ -198,7 +198,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
198198 }
199199 }
200200 if (fileCacheSource != null ) {
201- ignoreSourceException {
201+ ignoreException {
202202 val result = block(fileCacheSource as SOURCE )
203203 if (isActive && ! isClosedForSend) {
204204 send(result)
@@ -209,7 +209,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
209209 }
210210
211211 if (defaultSource != null ) {
212- ignoreSourceException {
212+ ignoreException {
213213 if (isActive && ! isClosedForSend) {
214214 send(block(defaultSource))
215215 }
@@ -221,7 +221,7 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
221221 }
222222
223223 val remoteException = if (remoteSource != null ) {
224- ignoreSourceException {
224+ ignoreException {
225225 val result = block(remoteSource)
226226 cacheReturnDeferred.cancel()
227227 send(result)
@@ -255,11 +255,11 @@ class OmegaRepository<SOURCE : Source>(vararg sources: SOURCE) {
255255
256256 }
257257
258- private inline fun ignoreSourceException (block : () -> Unit ): AppException ? {
258+ private inline fun ignoreException (block : () -> Unit ): Exception ? {
259259 return try {
260260 block()
261261 null
262- } catch (exception: AppException ) {
262+ } catch (exception: Exception ) {
263263 exception
264264 }
265265 }
0 commit comments