Tidy up error handling page
Summary: Some wording corrections, and added FlipperResponder section. Reviewed By: passy Differential Revision: D15200397 fbshipit-source-id: 2d52b1d7cb55b4cb8b0e15f00242201edf520f16
This commit is contained in:
committed by
Facebook Github Bot
parent
b3b75939a8
commit
37101cd1a7
@@ -7,7 +7,11 @@ Errors in Flipper plugins should be hidden from the user while providing actiona
|
|||||||
|
|
||||||
## Android
|
## Android
|
||||||
|
|
||||||
To gracefully handle errors in Flipper we provide the `ErrorReportingRunnable` class. This is a custom runnable which catches all exceptions, stopping them from crashing the application and reporting them to the plugin developer.
|
To gracefully handle errors in Flipper we provide the `ErrorReportingRunnable` and `FlipperResponder` classes.
|
||||||
|
|
||||||
|
A `FlipperResponder` instance is provided to the client plugin on every method call, and allows for it to return results. When an error occurs during a Flipper method call that can't be handled, pass the error to the responder. This will let the desktop plugin handle it, and if it doesn't, the error will be displayed in the DevTools console.
|
||||||
|
|
||||||
|
`ErrorReportingRunnable` is a custom `Runnable` which catches all exceptions, stopping them from crashing the application and reports them to Flipper. These error messages will show up in the DevTools console.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
new ErrorReportingRunnable(mConnection) {
|
new ErrorReportingRunnable(mConnection) {
|
||||||
@@ -18,7 +22,7 @@ new ErrorReportingRunnable(mConnection) {
|
|||||||
}.run();
|
}.run();
|
||||||
```
|
```
|
||||||
|
|
||||||
Executing this block of code will always finish without error but may transfer any silences error to the Flipper desktop app. During plugin development these java stack traces are surfaced in the chrome dev console. In production the errors are instead sent to and a task is assigned so that you can quickly deploy a fix.
|
Executing this block of code will always finish without error but may transfer any silent errors to the Flipper desktop app. During plugin development these java stack traces are surfaced in the chrome dev console.
|
||||||
|
|
||||||
Always use `ErrorReportingRunnable` for error handling instead of `try`/`catch` or even worse letting errors crash the app. With ErrorReportingRunnable you won't block anyone and you won't hide any stack traces.
|
Always use `ErrorReportingRunnable` for error handling instead of `try`/`catch` or even worse letting errors crash the app. With ErrorReportingRunnable you won't block anyone and you won't hide any stack traces.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user