Skip to content

Commit

Permalink
fix(sanitize): added error output
Browse files Browse the repository at this point in the history
  • Loading branch information
makhnatkin authored and 3y3 committed Nov 15, 2024
1 parent 08828e4 commit c7870d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/transform/sanitize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as cheerio from 'cheerio';
import css from 'css';

import {CssWhiteList} from './typings';
import log from './log';

const htmlTags = [
'a',
Expand Down Expand Up @@ -560,8 +561,11 @@ function sanitizeStyleTags(dom: cheerio.CheerioAPI, cssWhiteList: CssWhiteList)
});

dom(element).text(css.stringify(parsedCSS));
} catch {
} catch (error) {
dom(element).remove();

const errorMessage = error instanceof Error ? error.message : `${error}`;
log.info(errorMessage);
}
});
}
Expand Down

0 comments on commit c7870d9

Please sign in to comment.