Skip to content

Commit

Permalink
Add error handling in switch
Browse files Browse the repository at this point in the history
  • Loading branch information
gmickus committed Oct 18, 2024
1 parent fc67ab1 commit 0fb6210
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export class ProcedureParameterFormatter
);
break;
}
case SyntaxNodeType.Error:
newString = FormatterHelper.getCurrentText(node, fullText);
break;
default: {
const text = FormatterHelper.getCurrentText(
node,
Expand Down Expand Up @@ -192,6 +195,9 @@ export class ProcedureParameterFormatter
let newString = "";
const text = FormatterHelper.getCurrentText(node, fullText).trim();
switch (node.type) {
case SyntaxNodeType.Error:
newString = FormatterHelper.getCurrentText(node, fullText);
break;
default:
newString = text.length === 0 ? "" : " " + text;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ export class VariableDefinitionFormatter
VariableDefinitionFormatter.alignType - text.length
);
break;
case SyntaxNodeType.Error:
newString = FormatterHelper.getCurrentText(node, fullText);
break;
default: {
const text = FormatterHelper.getCurrentText(
node,
Expand Down Expand Up @@ -221,6 +224,9 @@ export class VariableDefinitionFormatter
let newString = "";
const text = FormatterHelper.getCurrentText(node, fullText).trim();
switch (node.type) {
case SyntaxNodeType.Error:
newString = FormatterHelper.getCurrentText(node, fullText);
break;
default:
newString = text.length === 0 ? "" : " " + text;
break;
Expand Down

0 comments on commit 0fb6210

Please sign in to comment.