Rename error type

This commit is contained in:
Lauren Tan
2024-03-28 10:40:04 -04:00
parent 638f8e3ddc
commit f4229cdb7f
3 changed files with 5 additions and 5 deletions
@@ -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;