mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Rename error type
This commit is contained in:
@@ -173,7 +173,7 @@ export class CompilerError extends Error {
|
||||
|
||||
constructor(...args: any[]) {
|
||||
super(...args);
|
||||
this.name = "ReactForgetCompilerError";
|
||||
this.name = "ReactCompilerError";
|
||||
}
|
||||
|
||||
override get message(): string {
|
||||
|
||||
@@ -20,7 +20,7 @@ describe("parseConfigPragma()", () => {
|
||||
validateHooksUsage: 1,
|
||||
} as any);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"[ReactForget] InvalidConfig: Validation error: Expected boolean, received number at "validateHooksUsage". Update Forget config to fix the error"`
|
||||
`"InvalidConfig: Validation error: Expected boolean, received number at "validateHooksUsage". Update Forget config to fix the error"`
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ function assertExhaustive(_: never, errorMsg: string): never {
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
function isReactForgetCompilerError(err: Error): err is CompilerError {
|
||||
return err.name === "ReactForgetCompilerError";
|
||||
function isReactCompilerError(err: Error): err is CompilerError {
|
||||
return err.name === "ReactCompilerError";
|
||||
}
|
||||
|
||||
function isReportableDiagnostic(
|
||||
@@ -131,7 +131,7 @@ const rule: Rule.RuleModule = {
|
||||
sourceType: "module",
|
||||
});
|
||||
} catch (err) {
|
||||
if (isReactForgetCompilerError(err) && Array.isArray(err.details)) {
|
||||
if (isReactCompilerError(err) && Array.isArray(err.details)) {
|
||||
for (const detail of err.details) {
|
||||
if (!isReportableDiagnostic(detail)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user