88 mergeConfigurations ,
99 pruneConfig ,
1010} from "@classmodel/class/config_utils" ;
11+ import { showToast } from "~/components/ui/toast" ;
1112import { decodeAppState } from "./encode" ;
1213import { parseExperimentConfig } from "./experiment_config" ;
1314import type { ExperimentConfig } from "./experiment_config" ;
@@ -38,9 +39,19 @@ export async function runExperiment(id: number) {
3839
3940 // Run reference
4041 const referenceConfig = unwrap ( exp . config . reference ) ;
41- const newOutput = await runClassAsync ( referenceConfig ) ;
42-
43- setExperiments ( id , "output" , "reference" , newOutput ) ;
42+ try {
43+ const newOutput = await runClassAsync ( referenceConfig ) ;
44+ setExperiments ( id , "output" , "reference" , newOutput ) ;
45+ } catch ( error ) {
46+ showToast ( {
47+ title : "Error running reference configuration" ,
48+ description : `${ ( error as Error ) . message } ; Please correct configuration and try again.` ,
49+ variant : "destructive" ,
50+ duration : Number . POSITIVE_INFINITY ,
51+ } ) ;
52+ setExperiments ( id , "output" , "running" , false ) ;
53+ return ;
54+ }
4455
4556 // Run permutations
4657 let permCounter = 0 ;
@@ -50,8 +61,19 @@ export async function runExperiment(id: number) {
5061 referenceConfig ,
5162 permConfig ,
5263 ) as Config ;
64+ try {
5365 const newOutput = await runClassAsync ( combinedConfig ) ;
5466 setExperiments ( id , "output" , "permutations" , permCounter , newOutput ) ;
67+ } catch ( error ) {
68+ showToast ( {
69+ title : `Error running permutation: ${ permConfig . name } ` ,
70+ description : `${ ( error as Error ) . message } . Please correct configuration and try again.` ,
71+ variant : "destructive" ,
72+ duration : Number . POSITIVE_INFINITY ,
73+ } ) ;
74+ setExperiments ( id , "output" , "running" , false ) ;
75+ return ;
76+ }
5577 permCounter ++ ;
5678 }
5779
0 commit comments