( request: Request, error: any, errorInfo: ThrownInfo, debugTask: null | ConsoleTask, )
| 1216 | } |
| 1217 | |
| 1218 | function logRecoverableError( |
| 1219 | request: Request, |
| 1220 | error: any, |
| 1221 | errorInfo: ThrownInfo, |
| 1222 | debugTask: null | ConsoleTask, |
| 1223 | ): ?string { |
| 1224 | // If this callback errors, we intentionally let that error bubble up to become a fatal error |
| 1225 | // so that someone fixes the error reporting instead of hiding it. |
| 1226 | const onError = request.onError; |
| 1227 | const errorDigest = |
| 1228 | __DEV__ && debugTask |
| 1229 | ? debugTask.run(onError.bind(null, error, errorInfo)) |
| 1230 | : onError(error, errorInfo); |
| 1231 | if (errorDigest != null && typeof errorDigest !== 'string') { |
| 1232 | // We used to throw here but since this gets called from a variety of unprotected places it |
| 1233 | // seems better to just warn and discard the returned value. |
| 1234 | if (__DEV__) { |
| 1235 | console.error( |
| 1236 | 'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "%s" instead', |
| 1237 | typeof errorDigest, |
| 1238 | ); |
| 1239 | } |
| 1240 | return; |
| 1241 | } |
| 1242 | return errorDigest; |
| 1243 | } |
| 1244 | |
| 1245 | function fatalError( |
| 1246 | request: Request, |
no test coverage detected