Skip to content

Commit

Permalink
Interngraph server error class
Browse files Browse the repository at this point in the history
Summary: We were losing the request body which meant that a clear request code could not be used, by adding an error subclass we can check for it in catch clause

Reviewed By: passy

Differential Revision: D59961466

fbshipit-source-id: 490e831759d90d4e83153daf4b7a4baa5b38dbdb
  • Loading branch information
Luke De Feo authored and facebook-github-bot committed Jul 31, 2024
1 parent 1a59aca commit 7143c79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions desktop/flipper-common/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export {
isError,
isAuthError,
FlipperServerDisconnectedError,
InternGraphServerError,
FlipperServerTimeoutError,
getStringFromErrorLike,
getErrorFromErrorLike,
Expand Down
10 changes: 10 additions & 0 deletions desktop/flipper-common/src/utils/errors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ export class ConnectivityError extends Error {
name: 'ConnectivityError';
}

export class InternGraphServerError extends Error {
body: any;
constructor(msg: string, body: any) {
super(msg);
this.name = 'InternGraphServerError';
this.body = body;
}
name: 'InternGraphServerError';
}

export class UserUnauthorizedError extends Error {
constructor(msg: string = 'User unauthorized.') {
super(msg);
Expand Down
1 change: 1 addition & 0 deletions desktop/flipper-plugin/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,5 @@ export {
ServerAddOn,
ServerAddOnPluginConnection,
FlipperServerForServerAddOn,
InternGraphServerError,
} from 'flipper-common';

0 comments on commit 7143c79

Please sign in to comment.