MCPcopy
hub / github.com/markedjs/marked / onError

Method onError

src/Instance.ts:349–368  ·  view source on GitHub ↗
(silent: boolean, async: boolean)

Source from the content-addressed store, hash-verified

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}

Callers 1

parseMethod · 0.95

Calls 1

escapeHtmlEntitiesFunction · 0.90

Tested by

no test coverage detected