Skip to content

Commit c065147

Browse files
authored
fix(#130): render text content if code parsing fails (#137)
1 parent a3aacb5 commit c065147

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Serilog.Ui.Web/src/__tests__/util/prettyPrints.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ describe('util: pretty prints', () => {
134134

135135
const actXml = await renderCodeContent('not an XML!', LogType.Xml);
136136

137-
expect(actXml).toBe('Content could not be parsed, as per expected type: xml');
137+
expect(actXml).toBe('not an XML!');
138138

139139
const actJson = await renderCodeContent('not a JSON!', LogType.Json);
140140

141-
expect(actJson).toBe('Content could not be parsed, as per expected type: json');
141+
expect(actJson).toBe('not a JSON!');
142142

143143
expect(consoleMock).toHaveBeenCalledTimes(2);
144144
});

src/Serilog.Ui.Web/src/app/util/prettyPrints.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const renderCodeContent = async (
8383
});
8484
}
8585
} catch {
86-
console.warn(`${modalContent} is not a valid json!`);
87-
return `Content could not be parsed, as per expected type: ${contentType}`;
86+
console.warn(`Content could not be parsed, as per expected type: ${contentType}`);
87+
return modalContent;
8888
}
8989
};

0 commit comments

Comments
 (0)