Fix uncaught exception in adb logging
Summary:
Found some random unhandled rejection. Added error catching / logging to adb logcat setup.
{F558587842}
Reviewed By: passy
Differential Revision: D27429914
fbshipit-source-id: faca682819a2f1a3f924ee176cc9f8c9f92f5ae9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7e9346e736
commit
238374f4db
@@ -44,39 +44,48 @@ export default class AndroidDevice extends BaseDevice {
|
||||
}
|
||||
|
||||
startLogging() {
|
||||
this.adb.openLogcat(this.serial, {clear: true}).then((reader) => {
|
||||
this.reader = reader;
|
||||
reader.on('entry', (entry) => {
|
||||
let type: LogLevel = 'unknown';
|
||||
if (entry.priority === Priority.VERBOSE) {
|
||||
type = 'verbose';
|
||||
}
|
||||
if (entry.priority === Priority.DEBUG) {
|
||||
type = 'debug';
|
||||
}
|
||||
if (entry.priority === Priority.INFO) {
|
||||
type = 'info';
|
||||
}
|
||||
if (entry.priority === Priority.WARN) {
|
||||
type = 'warn';
|
||||
}
|
||||
if (entry.priority === Priority.ERROR) {
|
||||
type = 'error';
|
||||
}
|
||||
if (entry.priority === Priority.FATAL) {
|
||||
type = 'fatal';
|
||||
}
|
||||
this.adb
|
||||
.openLogcat(this.serial, {clear: true})
|
||||
.then((reader) => {
|
||||
this.reader = reader;
|
||||
reader
|
||||
.on('entry', (entry) => {
|
||||
let type: LogLevel = 'unknown';
|
||||
if (entry.priority === Priority.VERBOSE) {
|
||||
type = 'verbose';
|
||||
}
|
||||
if (entry.priority === Priority.DEBUG) {
|
||||
type = 'debug';
|
||||
}
|
||||
if (entry.priority === Priority.INFO) {
|
||||
type = 'info';
|
||||
}
|
||||
if (entry.priority === Priority.WARN) {
|
||||
type = 'warn';
|
||||
}
|
||||
if (entry.priority === Priority.ERROR) {
|
||||
type = 'error';
|
||||
}
|
||||
if (entry.priority === Priority.FATAL) {
|
||||
type = 'fatal';
|
||||
}
|
||||
|
||||
this.addLogEntry({
|
||||
tag: entry.tag,
|
||||
pid: entry.pid,
|
||||
tid: entry.tid,
|
||||
message: entry.message,
|
||||
date: entry.date,
|
||||
type,
|
||||
});
|
||||
this.addLogEntry({
|
||||
tag: entry.tag,
|
||||
pid: entry.pid,
|
||||
tid: entry.tid,
|
||||
message: entry.message,
|
||||
date: entry.date,
|
||||
type,
|
||||
});
|
||||
})
|
||||
.on('error', (e) => {
|
||||
console.warn('Failed to read from adb logcat: ', e);
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.warn('Failed to open log stream: ', e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
stopLogging() {
|
||||
|
||||
Reference in New Issue
Block a user