mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-06-27 16:36:53 +00:00
fix: Catch optimize error and return error message. (#534)
This commit is contained in:
parent
7ade15e9e3
commit
c89e8e95fa
@ -1147,9 +1147,14 @@ def fastapi_optimize(
|
||||
|
||||
# Perform optimization simulation
|
||||
opt_class = optimization_problem(verbose=bool(config_eos.server.verbose))
|
||||
result = opt_class.optimierung_ems(parameters=parameters, start_hour=start_hour, **extra_args)
|
||||
# print(result)
|
||||
return result
|
||||
try:
|
||||
result = opt_class.optimierung_ems(
|
||||
parameters=parameters, start_hour=start_hour, **extra_args
|
||||
)
|
||||
# print(result)
|
||||
return result
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=400, detail=f"Optimize error: {e}.")
|
||||
|
||||
|
||||
@app.get("/visualization_results.pdf", response_class=PdfResponse, tags=["optimize"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user