fix(backend): try-catch MarkdownProcessor

Co-authored-by: Gerald Schmittinger <gerald.schmittinger@ugent.be>
This commit is contained in:
Tibo De Peuter 2025-03-30 11:36:43 +02:00
parent 90d61a6f26
commit fd5da70d49
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2

View file

@ -8,7 +8,6 @@ import { DwengoContentType } from '../content-type.js';
import dwengoMarkedRenderer from './dwengo-marked-renderer.js';
import { StringProcessor } from '../string-processor.js';
import { ProcessingError } from '../processing-error.js';
import { YAMLException } from 'js-yaml';
class MarkdownProcessor extends StringProcessor {
constructor() {
@ -30,10 +29,6 @@ class MarkdownProcessor extends StringProcessor {
const html = marked(mdText, { async: false });
return MarkdownProcessor.replaceLinks(html); // Replace html image links path
} catch (e: unknown) {
if (e instanceof YAMLException) {
throw new ProcessingError(e.message);
}
throw new ProcessingError('Unknown error while processing markdown: ' + e);
}
}