Skip to content

Instantly share code, notes, and snippets.

@rostopira
Created September 8, 2017 12:11
Show Gist options
  • Save rostopira/1cdf1480eabe17206608152a3ef93885 to your computer and use it in GitHub Desktop.
Save rostopira/1cdf1480eabe17206608152a3ef93885 to your computer and use it in GitHub Desktop.
package com.kid.gl.utils
import android.util.Log
import com.google.firebase.crash.FirebaseCrash
import com.google.firebase.database.DatabaseError
import gl.kid.alert.BuildConfig
private const val TAG = "FirePig"
class FirePig(message: String): Exception(message) {
companion object {
fun fly(vararg objects: Any?) {
val text = objects.joinToString(" ")
FirePig(text).fly()
Log.wtf(TAG, text)
}
}
}
fun Throwable.fly(tag: String = TAG) {
if (!BuildConfig.DEBUG)
FirebaseCrash.report(this)
Log.wtf(tag, this)
}
fun DatabaseError.fly(tag: String = TAG) {
this.toException().fly(tag)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment