Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples to use the new recordException overload. #596

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ public void logCaughtEx() {
// [END crash_log_caught_ex]
}

public void logCaughtExWithCustomKeys() {
// [START crash_log_caught_ex_custom_keys]
try {
methodThatThrows();
} catch (Exception e) {
CustomKeysAndValues keysAndValues = new CustomKeysAndValues.Builder()
.putString("string key", "string value")
.putBoolean("boolean key", true)
.putFloat("float key", Float.MAX_VALUE)
.build();
FirebaseCrashlytics.getInstance().recordException(e, keysAndValues);
// handle your exception here
}
// [END crash_log_caught_ex_custom_keys]
}

public void forceACrash() {
// [START crash_force_crash]
Button crashButton = new Button(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ class MainActivity : AppCompatActivity() {
// [END crash_log_caught_ex]
}

fun logCaughtExWithCustomKeys() {
// [START crash_log_caught_ex_custom_keys]
try {
methodThatThrows()
} catch (e: Exception) {
Firebase.crashlytics.recordException(e) {
key("string key", "string value")
key("boolean key", true)
key("float key", Float.MAX_VALUE)
}
// handle your exception here
}
// [END crash_log_caught_ex_custom_keys]
}

fun forceACrash() {
// [START crash_force_crash]
val crashButton = Button(this)
Expand Down
Loading