Skip to content

Commit 1cec67e

Browse files
committed
fix: only push notification if there's no critical error
1 parent 103f51b commit 1cec67e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/utils/document.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,6 @@ export interface BundlingError {
127127
}
128128

129129
export const createBundlingErrorHandler = (ctx: BuilderContext, fileId: FileId) => (errors: BundlingError[]): void => {
130-
// Always push all errors to notifications
131-
for (const error of errors) {
132-
ctx.notifications.push({
133-
severity: MESSAGE_SEVERITY.Error,
134-
message: error.message,
135-
fileId: fileId,
136-
})
137-
}
138-
139130
// Only throw if severity is ERROR and there's at least one critical error
140131
if (ctx.config.validationRulesSeverity?.brokenRefs === VALIDATION_RULES_SEVERITY_LEVEL_ERROR) {
141132
const criticalError = errors.find(error =>
@@ -147,6 +138,15 @@ export const createBundlingErrorHandler = (ctx: BuilderContext, fileId: FileId)
147138
throw new Error(criticalError.message)
148139
}
149140
}
141+
142+
// In other cases push all errors to notifications
143+
for (const error of errors) {
144+
ctx.notifications.push({
145+
severity: MESSAGE_SEVERITY.Error,
146+
message: error.message,
147+
fileId: fileId,
148+
})
149+
}
150150
}
151151

152152
export const getBundledFileDataWithDependencies = async (

0 commit comments

Comments
 (0)