Give clear error when sexp module not available
Instead of falling through to YAML parsing (which gives confusing errors), return a clear message that artdag.sexp is required but not installed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,7 +73,9 @@ async def upload_recipe(
|
|||||||
variable_inputs = []
|
variable_inputs = []
|
||||||
fixed_inputs = []
|
fixed_inputs = []
|
||||||
|
|
||||||
if is_sexp and SEXP_AVAILABLE:
|
if is_sexp:
|
||||||
|
if not SEXP_AVAILABLE:
|
||||||
|
raise HTTPException(500, "S-expression recipes require artdag.sexp module (not installed on server)")
|
||||||
# Parse S-expression
|
# Parse S-expression
|
||||||
try:
|
try:
|
||||||
compiled = compile_string(content)
|
compiled = compile_string(content)
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ class RecipeService:
|
|||||||
recipe_data = None
|
recipe_data = None
|
||||||
is_sexp = _is_sexp_format(content)
|
is_sexp = _is_sexp_format(content)
|
||||||
|
|
||||||
if is_sexp and SEXP_AVAILABLE:
|
if is_sexp:
|
||||||
|
if not SEXP_AVAILABLE:
|
||||||
|
return {"error": "S-expression recipes require artdag.sexp module (not installed)", "recipe_id": recipe_id}
|
||||||
# Parse as S-expression
|
# Parse as S-expression
|
||||||
try:
|
try:
|
||||||
compiled = compile_string(content)
|
compiled = compile_string(content)
|
||||||
@@ -153,7 +155,9 @@ class RecipeService:
|
|||||||
# Detect format
|
# Detect format
|
||||||
is_sexp = _is_sexp_format(content)
|
is_sexp = _is_sexp_format(content)
|
||||||
|
|
||||||
if is_sexp and SEXP_AVAILABLE:
|
if is_sexp:
|
||||||
|
if not SEXP_AVAILABLE:
|
||||||
|
return None, "S-expression recipes require artdag.sexp module (not installed on server)"
|
||||||
# Validate S-expression
|
# Validate S-expression
|
||||||
try:
|
try:
|
||||||
compiled = compile_string(content)
|
compiled = compile_string(content)
|
||||||
|
|||||||
Reference in New Issue
Block a user