Skip to content

Commit 7cb8781

Browse files
committed
fix(onramp): suppress Bugsnag reporting for user-caused onramp web errors
CoinbaseOnRampWebError extends plain Throwable, so ErrorUtils.handleError falls through to `throwableCause !is CodeServerError` which defaults isNotifiable to true — causing every user-caused error (card declines, region mismatches, GPay not supported, etc.) to be reported to Bugsnag. Make the base sealed class implement ConditionallyNotifiable with isNotifiable = false. Subclasses representing genuine unexpected failures (UnknownFailure, InternalFailure, SendFailed, ProcessingFailed) retain NotifiableError with an explicit override. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 132896a commit 7cb8781

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

apps/flipcash/shared/onramp/coinbase/src/main/kotlin/com/flipcash/app/onramp/internal/CoinbaseOnRampEventHandler.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.flipcash.app.onramp.internal
22

3+
import com.getcode.utils.ConditionallyNotifiable
34
import com.getcode.utils.NotifiableError
45
import com.getcode.utils.TraceType
56
import com.getcode.utils.trace
@@ -268,12 +269,14 @@ internal class CoinbaseOnRampEventHandler(
268269
}
269270

270271
/** @see [Docs](https://docs.cdp.coinbase.com/onramp/headless-onramp/overview#events-names) */
271-
sealed class CoinbaseOnRampWebError(val data: String? = null) : Throwable(data) {
272+
sealed class CoinbaseOnRampWebError(val data: String? = null) : Throwable(data), ConditionallyNotifiable {
273+
override val isNotifiable: Boolean get() = false
272274

273275
// --- Grouped errors (shared UI) ---
274276

275277
/** "Something Went Wrong" — unknown / unmapped error codes */
276278
sealed class UnknownFailure(data: String?) : CoinbaseOnRampWebError(data), NotifiableError {
279+
override val isNotifiable: Boolean get() = true
277280
class Unknown(data: String? = null) : UnknownFailure(data)
278281
class MissingTransactionUuid(data: String? = null) : UnknownFailure(data)
279282
}
@@ -294,6 +297,7 @@ sealed class CoinbaseOnRampWebError(val data: String? = null) : Throwable(data)
294297

295298
/** "Something Went Wrong" — internal / infra failures */
296299
sealed class InternalFailure(data: String?) : CoinbaseOnRampWebError(data), NotifiableError {
300+
override val isNotifiable: Boolean get() = true
297301
class Internal(data: String? = null) : InternalFailure(data)
298302
class GooglePayButtonNotFound(data: String? = null) : InternalFailure(data)
299303
class WebViewTimeout(data: String? = null) : InternalFailure(data)
@@ -303,8 +307,12 @@ sealed class CoinbaseOnRampWebError(val data: String? = null) : Throwable(data)
303307
/** "Something Went Wrong" — transaction processing failure */
304308
sealed class TransactionFailed(data: String?) : CoinbaseOnRampWebError(data) {
305309
class GooglePayError(data: String? = null) : TransactionFailed(data)
306-
class SendFailed(data: String? = null) : TransactionFailed(data), NotifiableError
307-
class ProcessingFailed(data: String? = null) : TransactionFailed(data), NotifiableError
310+
class SendFailed(data: String? = null) : TransactionFailed(data), NotifiableError {
311+
override val isNotifiable: Boolean get() = true
312+
}
313+
class ProcessingFailed(data: String? = null) : TransactionFailed(data), NotifiableError {
314+
override val isNotifiable: Boolean get() = true
315+
}
308316
}
309317

310318
/** "Your Region Isn't Supported" — region / asset availability */

0 commit comments

Comments
 (0)