File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
typescript/packages/toolshed/routes/ai/spell Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,13 @@ export class MemoryError extends Error {
2121}
2222
2323function handleErrorResponse ( data : any ) {
24+ if ( typeof data . error === "string" ) {
25+ throw new MemoryError ( data . error , data ) ;
26+ }
2427 if ( "cause" in data . error ) {
2528 throw new MemoryError ( data ?. error ?. cause ?. message , data ) ;
2629 } else {
27- throw new MemoryError ( data ?. error ?. message , data ) ;
30+ throw new MemoryError ( data ?. error ?. message || "Unknown error" , data ) ;
2831 }
2932}
3033
Original file line number Diff line number Diff line change @@ -446,12 +446,14 @@ async function processRecast(
446446 const argument = source . value . argument ;
447447 const type = source . value . $TYPE ;
448448 logger . debug ( { type, argument } , "Extracted argument and type from source" ) ;
449-
450449 const spellId = "spell-" + type ;
451450 logger . info ( { spellId } , "Looking up spell" ) ;
452451
453452 const spell = await getBlob < Spell > ( spellId ) ;
454453 logger . info ( { spellId } , "Retrieved spell" ) ;
454+ if ( ! spell ) {
455+ throw new Error ( "No spell found for id: " + spellId ) ;
456+ }
455457
456458 const schema = spell . recipe . argumentSchema ;
457459 logger . debug ( { schema } , "Extracted argument schema from spell" ) ;
You can’t perform that action at this time.
0 commit comments