mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
framework: show step error detail
This commit is contained in:
3 files changed
+3
-6
No files matched your search
@@ -528,7 +528,7 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
else if (typeof h[step] === 'function') control = await h[step](args);
|
||||
if (control) {
|
||||
const index = steps.findIndex((i) => control === i);
|
||||
if (index === -1) throw new Error(`Invalid control: ${control}`);
|
||||
if (index === -1) throw new Error(`Invalid control: ${control} (after step ${step})`);
|
||||
if (index <= current) {
|
||||
logger.warn('Returning to previous step is not recommended:', step, '->', control);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
// https://github.com/waylonflinn/markdown-it-katex/blob/master/index.js
|
||||
import { Logger } from 'hydrooj';
|
||||
import katex from 'katex';
|
||||
|
||||
const logger = new Logger('katex');
|
||||
|
||||
function isValidDelim(state, pos) {
|
||||
const max = state.posMax;
|
||||
const prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
|
||||
@@ -118,7 +115,7 @@ export default function plugin(md) {
|
||||
latex = latex.replace(/\\def{\\([a-zA-Z0-9]+)}/g, '\\def\\$1');
|
||||
return katex.renderToString(latex, options);
|
||||
} catch (error) {
|
||||
if (options.throwOnError) logger.error(error);
|
||||
if (options.throwOnError) console.error(error);
|
||||
return `<p class='${displayMode ? 'katex-block ' : ''}katex-error' title='${escapeHtml(error.toString())}'>${escapeHtml(latex)}</p>`;
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
declare module '*.vue' {
|
||||
export default {} as any;
|
||||
export default {} as any;
|
||||
}
|
||||
Reference in new issue
Block a user