-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ReactDebugTools] add custom error type for future new hooks
- Loading branch information
1 parent
e7d0053
commit a11680b
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* 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. | ||
* | ||
* @flow | ||
*/ | ||
|
||
/** | ||
* This file contains a list of custom Errors that ReactDebugTools can throw in | ||
* special occasions. | ||
* The names of the errors are exported so that other packages (such as DevTools) | ||
* can use them to detect and handle them separately. | ||
*/ | ||
|
||
export const ErrorsNames = { | ||
UNSUPPORTTED_FEATURE_ERROR: 'UnsupportedFeatureError', | ||
}; | ||
|
||
// For now we just override the name. If we decide to move react-debug-tools to | ||
// devtools package, we should use a real Error class instead. | ||
export function createUnsupportedFeatureError(message: string = '') { | ||
const error = new Error(message); | ||
error.name = ErrorsNames.UNSUPPORTTED_FEATURE_ERROR; | ||
return error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters