Replace usages of ErrorReporter with Logger
Summary: At the moment, in sonar we have an error reporter and a Logger. ErrorReporter can be encapsulated into Logger, so users don't have to decide between logging and reporting errors. Reviewed By: danielbuechele Differential Revision: D8531902 fbshipit-source-id: 3986f51ea163ac939f3baffd4db3ab968f2a0762
This commit is contained in:
committed by
Facebook Github Bot
parent
3d27dc2004
commit
54fa6aa8f2
@@ -18,7 +18,6 @@ import {Server, Client} from './server.js';
|
|||||||
import * as reducers from './reducers.js';
|
import * as reducers from './reducers.js';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import BugReporter from './fb-stubs/BugReporter.js';
|
import BugReporter from './fb-stubs/BugReporter.js';
|
||||||
import ErrorReporter from './fb-stubs/ErrorReporter.js';
|
|
||||||
import BugReporterDialog from './chrome/BugReporterDialog.js';
|
import BugReporterDialog from './chrome/BugReporterDialog.js';
|
||||||
import ErrorBar from './chrome/ErrorBar.js';
|
import ErrorBar from './chrome/ErrorBar.js';
|
||||||
import Logger from './fb-stubs/Logger.js';
|
import Logger from './fb-stubs/Logger.js';
|
||||||
@@ -75,14 +74,12 @@ export class App extends React.Component<Props, State> {
|
|||||||
server: this.initServer(),
|
server: this.initServer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.errorReporter = new ErrorReporter(this.logger.scribeLogger);
|
|
||||||
this.bugReporter = new BugReporter(this.logger);
|
this.bugReporter = new BugReporter(this.logger);
|
||||||
this.commandLineArgs = yargs.parse(electron.remote.process.argv);
|
this.commandLineArgs = yargs.parse(electron.remote.process.argv);
|
||||||
|
|
||||||
setupMenu(this.sendKeyboardAction);
|
setupMenu(this.sendKeyboardAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorReporter: ErrorReporter;
|
|
||||||
bugReporter: BugReporter;
|
bugReporter: BugReporter;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
commandLineArgs: Object;
|
commandLineArgs: Object;
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This class exists to allow error reporting to your own service.
|
||||||
|
* The recommended way to use this, is to instantiate it inside LogManager,
|
||||||
|
* so that all logged errors get reported to this class.
|
||||||
|
*/
|
||||||
export function cleanStack(stack: string, loc: ?string) {}
|
export function cleanStack(stack: string, loc: ?string) {}
|
||||||
import type ScribeLogger from './ScribeLogger';
|
import type ScribeLogger from './ScribeLogger';
|
||||||
|
|
||||||
|
|||||||
@@ -171,11 +171,12 @@ export class Client extends EventEmitter {
|
|||||||
if (id == null) {
|
if (id == null) {
|
||||||
const {error} = data;
|
const {error} = data;
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
this.app.logger.error(error.stacktrace || error.message, 'deviceError');
|
this.app.logger.error(
|
||||||
this.app.errorReporter.report({
|
`Error received from device ${
|
||||||
message: error.message,
|
method ? `when calling ${method}` : ''
|
||||||
stack: error.stacktrace,
|
}: ${error.message} + \nDevice Stack Trace: ${error.stacktrace}`,
|
||||||
});
|
'deviceError',
|
||||||
|
);
|
||||||
} else if (method === 'refreshPlugins') {
|
} else if (method === 'refreshPlugins') {
|
||||||
this.refreshPlugins();
|
this.refreshPlugins();
|
||||||
} else if (method === 'execute') {
|
} else if (method === 'execute') {
|
||||||
|
|||||||
Reference in New Issue
Block a user