Summary: Currently cancelling the flipper export logs the event as a failure. This diff introduces one more event log type called cancelled. Reviewed By: jknoxville Differential Revision: D16711110 fbshipit-source-id: 308b7e64974610dbb17bd14b2425f6d939c99313
23 lines
522 B
TypeScript
23 lines
522 B
TypeScript
/**
|
|
* Copyright 2018-present Facebook.
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
* @format
|
|
*/
|
|
|
|
export class CancelledPromiseError extends Error {
|
|
constructor(msg: string) {
|
|
super(msg);
|
|
this.name = 'CancelledPromiseError';
|
|
}
|
|
}
|
|
export function getStringFromErrorLike(e: any) {
|
|
if (typeof e == 'string') {
|
|
return e;
|
|
} else if (e instanceof Error) {
|
|
return e.message;
|
|
} else {
|
|
return JSON.stringify(e);
|
|
}
|
|
}
|