Skip to content

Commit

Permalink
fix(transform): filter empty issues and keep stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 9, 2024
1 parent 0c038a2 commit 83845d6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export async function transform(
}

const hasChanged = editor.hasChanged();
const hasIssues = updates.some((u) => u.result.issues?.length);
const hasIssues = updates.some(
(u) => u.result.issues?.filter(Boolean).length,
);
const time = performance.now() - start;

return {
Expand Down Expand Up @@ -140,15 +142,14 @@ async function _transformBlock(
result.issues = [
...(result.issues || []),
...nestedRes.updates.flatMap((u) => u.result.issues || []),
];
].filter(Boolean);
}
}

return result;
} catch (_error: any) {
const error = `(${block.generator}) ${_error.message || _error}`;
} catch (error: any) {
return {
contents: `<!-- ⚠️ ${error} -->`,
contents: `<!-- ⚠️ (${block.generator}) ${error.message || error} -->`,
issues: [error],
};
}
Expand Down

0 comments on commit 83845d6

Please sign in to comment.