mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Make API return error before raising error again (#606)
This change makes it so any API clients can show the same error as what happens in the terminal where you run the API. Useful for various WebUIs to display more helpful error messages to users. Co-authored-by: CapableWeb <capableweb@domain.com>
This commit is contained in:
parent
f9b272a7b9
commit
58baf9533b
@ -247,6 +247,15 @@ class DreamServer(BaseHTTPRequestHandler):
|
||||
except CanceledException:
|
||||
print(f"Canceled.")
|
||||
return
|
||||
except Exception as e:
|
||||
print("Error happened")
|
||||
print(e)
|
||||
self.wfile.write(bytes(json.dumps(
|
||||
{'event': 'error',
|
||||
'message': str(e),
|
||||
'type': e.__class__.__name__}
|
||||
) + '\n',"utf-8"))
|
||||
raise e
|
||||
|
||||
|
||||
class ThreadingDreamServer(ThreadingHTTPServer):
|
||||
|
Loading…
Reference in New Issue
Block a user