(silent: boolean, async: boolean)
| 347 | } |
| 348 | |
| 349 | private onError(silent: boolean, async: boolean) { |
| 350 | return (e: Error): string | Promise<string> => { |
| 351 | e.message += '\nPlease report this to https://github.com/markedjs/marked.'; |
| 352 | |
| 353 | if (silent) { |
| 354 | const msg = '<p>An error occurred:</p><pre>' |
| 355 | + escapeHtmlEntities(e.message + '', true) |
| 356 | + '</pre>'; |
| 357 | if (async) { |
| 358 | return Promise.resolve(msg); |
| 359 | } |
| 360 | return msg; |
| 361 | } |
| 362 | |
| 363 | if (async) { |
| 364 | return Promise.reject(e); |
| 365 | } |
| 366 | throw e; |
| 367 | }; |
| 368 | } |
| 369 | } |
no test coverage detected