Skip to content

Commit

Permalink
Remove unnecessary try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
gitKrystan committed Dec 3, 2023
1 parent 2157659 commit 7b467f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
27 changes: 10 additions & 17 deletions src/print/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,16 @@ export const printer: Printer<Node | undefined> = {
return async (textToDoc) => {
try {
if (node && isGlimmerTemplate(node)) {
let content = null;
let raw = false;
try {
content = await printTemplateContent(
node.extra.template,
textToDoc,
embedOptions as Options,
);
} catch {
content = node.extra.template;
raw = true;
}

const printed = printTemplateTag(content, {
useHardline: node.extra.isDefaultTemplate,
raw,
});
const content = await printTemplateContent(
node.extra.template,
textToDoc,
embedOptions as Options,
);

const printed = printTemplateTag(
content,
node.extra.isDefaultTemplate,
);
saveCurrentPrintOnSiblingNode(path, printed);
return printed;
}
Expand Down
7 changes: 2 additions & 5 deletions src/print/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ export async function printTemplateContent(
*/
export function printTemplateTag(
content: doc.builders.Doc,
options: {
useHardline: boolean;
raw: boolean;
},
useHardline: boolean,
): doc.builders.Doc {
const line = options.raw ? '' : options.useHardline ? hardline : softline;
const line = useHardline ? hardline : softline;
const doc = [
TEMPLATE_TAG_OPEN,
indent([line, group(content)]),
Expand Down

0 comments on commit 7b467f6

Please sign in to comment.