Skip to content
Snippets Groups Projects
Commit c5e2471f authored by David Sehnal's avatar David Sehnal
Browse files

mol-state/task: use console.error only when not in production mode

parent e9802f21
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ import { now, formatTimespan } from '../mol-util/now'; ...@@ -20,6 +20,7 @@ import { now, formatTimespan } from '../mol-util/now';
import { ParamDefinition } from '../mol-util/param-definition'; import { ParamDefinition } from '../mol-util/param-definition';
import { StateTreeSpine } from './tree/spine'; import { StateTreeSpine } from './tree/spine';
import { AsyncQueue } from '../mol-util/async-queue'; import { AsyncQueue } from '../mol-util/async-queue';
import { isProductionMode } from '../mol-util/debug'
export { State } export { State }
...@@ -586,7 +587,7 @@ async function updateSubtree(ctx: UpdateContext, root: Ref) { ...@@ -586,7 +587,7 @@ async function updateSubtree(ctx: UpdateContext, root: Ref) {
ctx.changed = true; ctx.changed = true;
if (!ctx.hadError) ctx.newCurrent = root; if (!ctx.hadError) ctx.newCurrent = root;
doError(ctx, root, e, false); doError(ctx, root, e, false);
console.error(e); if (!isProductionMode) console.error(e);
return; return;
} }
......
...@@ -10,6 +10,7 @@ import { Progress } from './progress' ...@@ -10,6 +10,7 @@ import { Progress } from './progress'
import { now } from '../../mol-util/now'; import { now } from '../../mol-util/now';
import { Scheduler } from '../util/scheduler' import { Scheduler } from '../util/scheduler'
import { UserTiming } from '../util/user-timing' import { UserTiming } from '../util/user-timing'
import { isProductionMode } from '../../mol-util/debug'
interface ExposedTask<T> extends Task<T> { interface ExposedTask<T> extends Task<T> {
f: (ctx: RuntimeContext) => Promise<T>, f: (ctx: RuntimeContext) => Promise<T>,
...@@ -30,10 +31,6 @@ export function ExecuteObservableChild<T>(ctx: RuntimeContext, task: Task<T>, pr ...@@ -30,10 +31,6 @@ export function ExecuteObservableChild<T>(ctx: RuntimeContext, task: Task<T>, pr
return (ctx as ObservableRuntimeContext).runChild(task as ExposedTask<T>, progress); return (ctx as ObservableRuntimeContext).runChild(task as ExposedTask<T>, progress);
} }
export namespace ExecuteObservable {
export let PRINT_ERRORS_TO_STD_ERR = false;
}
function defaultProgress(task: Task<any>): Task.Progress { function defaultProgress(task: Task<any>): Task.Progress {
return { return {
taskId: task.id, taskId: task.id,
...@@ -112,7 +109,7 @@ async function execute<T>(task: ExposedTask<T>, ctx: ObservableRuntimeContext) { ...@@ -112,7 +109,7 @@ async function execute<T>(task: ExposedTask<T>, ctx: ObservableRuntimeContext) {
task.onAbort(); task.onAbort();
} }
} }
if (ExecuteObservable.PRINT_ERRORS_TO_STD_ERR) console.error(e); if (!isProductionMode) console.error(e);
throw e; throw e;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment