Add info about interactions to error reports

Summary: When reporting errors we could add info about interactions which caused errors. Ability to connect errors and interactions could be quite helpful for analysing and debugging errors and where they are coming from.

Reviewed By: passy, mweststrate

Differential Revision: D28467575

fbshipit-source-id: bef69917a4d6c786d762a2f6eb75a47fd4e46b0f
This commit is contained in:
Anton Nikolaev
2021-05-18 08:06:07 -07:00
committed by Facebook GitHub Bot
parent 03a1add092
commit 853ee24c9b
9 changed files with 51 additions and 13 deletions

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export function v4() {
return '00000000-0000-0000-0000-000000000000';
}
export function v1() {
return '00000000-0000-0000-0000-000000000000';
}

View File

@@ -15,14 +15,7 @@
export function cleanStack(_stack: string, _loc?: string) {}
import ScribeLogger from './ScribeLogger';
export type ObjectError =
| Error
| {
message: string;
stack?: string;
};
export default class ErrorReporter {
constructor(_scribeLogger: ScribeLogger) {}
report(_err: ObjectError) {}
report(_err: Error) {}
}

View File

@@ -7,11 +7,20 @@
* @format
*/
import {InteractionReport} from 'flipper-plugin';
export class CancelledPromiseError extends Error {
constructor(msg: string) {
super(msg);
this.name = 'CancelledPromiseError';
}
name: 'CancelledPromiseError';
}
declare global {
interface Error {
interaction?: InteractionReport;
}
}
export function isError(obj: any): obj is Error {