Skip to content

Commit

Permalink
Rename getRollupEror to getRollupError (#5398)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRefactoring committed Feb 22, 2024
1 parent c9b3655 commit 67d7f10
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions scripts/generate-buffer-to-ast.js
Expand Up @@ -192,16 +192,16 @@ import {
} from './astConverterHelpers';
import { FIXED_STRINGS } from './convert-ast-strings';
import type { ReadString } from './getReadStringFunction';
import { error, getRollupEror, logParseError } from './logs';
import { error, getRollupError, logParseError } from './logs';
export function convertProgram(buffer: ArrayBuffer, readString: ReadString): ProgramNode {
const node = convertNode(0, new Uint32Array(buffer), readString);
switch (node.type) {
case PanicError: {
return error(getRollupEror(logParseError(node.message)));
return error(getRollupError(logParseError(node.message)));
}
case ParseError: {
return error(getRollupEror(logParseError(node.message, node.start)));
return error(getRollupError(logParseError(node.message, node.start)));
}
default: {
return node;
Expand Down
4 changes: 2 additions & 2 deletions src/ast/nodes/PanicError.ts
@@ -1,4 +1,4 @@
import { error, getRollupEror, logModuleParseError, logParseError } from '../../utils/logs';
import { error, getRollupError, logModuleParseError, logParseError } from '../../utils/logs';
import type * as NodeType from './NodeType';
import { NodeBase } from './shared/Node';

Expand All @@ -10,7 +10,7 @@ export default class PanicError extends NodeBase {
const id = this.scope.context.module.id;
// This simulates the current nested error structure. We could also just
// replace it with a flat error.
const parseError = getRollupEror(logParseError(this.message));
const parseError = getRollupError(logParseError(this.message));
const moduleParseError = logModuleParseError(parseError, id);
return error(moduleParseError);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ast/nodes/ParseError.ts
@@ -1,4 +1,4 @@
import { getRollupEror, logModuleParseError, logParseError } from '../../utils/logs';
import { getRollupError, logModuleParseError, logParseError } from '../../utils/logs';
import type * as NodeType from './NodeType';
import { NodeBase } from './shared/Node';

Expand All @@ -11,7 +11,7 @@ export default class ParseError extends NodeBase {
const id = this.scope.context.module.id;
// This simulates the current nested error structure. We could also just
// replace it with a flat error.
const parseError = getRollupEror(logParseError(this.message, pos));
const parseError = getRollupError(logParseError(this.message, pos));
const moduleParseError = logModuleParseError(parseError, id);
this.scope.context.error(moduleParseError, pos);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/bufferToAst.ts
Expand Up @@ -13,16 +13,16 @@ import {
} from './astConverterHelpers';
import { FIXED_STRINGS } from './convert-ast-strings';
import type { ReadString } from './getReadStringFunction';
import { error, getRollupEror, logParseError } from './logs';
import { error, getRollupError, logParseError } from './logs';

export function convertProgram(buffer: ArrayBuffer, readString: ReadString): ProgramNode {
const node = convertNode(0, new Uint32Array(buffer), readString);
switch (node.type) {
case PanicError: {
return error(getRollupEror(logParseError(node.message)));
return error(getRollupError(logParseError(node.message)));
}
case ParseError: {
return error(getRollupEror(logParseError(node.message, node.start)));
return error(getRollupError(logParseError(node.message, node.start)));
}
default: {
return node;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/logs.ts
Expand Up @@ -33,10 +33,10 @@ import {
} from './urls';

export function error(base: Error | RollupLog): never {
throw base instanceof Error ? base : getRollupEror(base);
throw base instanceof Error ? base : getRollupError(base);
}

export function getRollupEror(base: RollupLog): Error & RollupLog {
export function getRollupError(base: RollupLog): Error & RollupLog {
const errorInstance = Object.assign(new Error(base.message), base);
Object.defineProperty(errorInstance, 'name', { value: 'RollupError', writable: true });
return errorInstance;
Expand Down

0 comments on commit 67d7f10

Please sign in to comment.