From 58baf9533b9f022f9247e96764101c132cd6fad5 Mon Sep 17 00:00:00 2001
From: CapableWeb <112625454+CapableWeb@users.noreply.github.com>
Date: Fri, 16 Sep 2022 13:33:42 +0200
Subject: [PATCH 1/2] 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>
---
 ldm/dream/server.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ldm/dream/server.py b/ldm/dream/server.py
index b56e21f6c7..002d630326 100644
--- a/ldm/dream/server.py
+++ b/ldm/dream/server.py
@@ -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):

From 45af30f3a4c98b50c755717831c5fff75a3a8b43 Mon Sep 17 00:00:00 2001
From: tildebyte <337875+tildebyte@users.noreply.github.com>
Date: Fri, 16 Sep 2022 07:39:23 -0400
Subject: [PATCH 2/2] fix(install): unpinned 'protobuf' breaks macOS installs
 (#596)

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>

Signed-off-by: Ben Alkov <ben.alkov@gmail.com>
---
 environment-mac.yaml         | 1 +
 requirements-mac-MPS-CPU.txt | 1 +
 2 files changed, 2 insertions(+)

diff --git a/environment-mac.yaml b/environment-mac.yaml
index 8067c712ee..9932b5cc0c 100644
--- a/environment-mac.yaml
+++ b/environment-mac.yaml
@@ -41,6 +41,7 @@ dependencies:
   - torchmetrics==0.9.3
   - pip:
     - opencv-python==4.6.0
+    - protobuf==3.20.1
     - realesrgan==0.2.5.0
     - test-tube==0.7.5
     - transformers==4.21.2
diff --git a/requirements-mac-MPS-CPU.txt b/requirements-mac-MPS-CPU.txt
index b6b1f2bb2f..a785a61372 100644
--- a/requirements-mac-MPS-CPU.txt
+++ b/requirements-mac-MPS-CPU.txt
@@ -3,6 +3,7 @@
 --pre
 --extra-index-url https://download.pytorch.org/whl/nightly/cpu --trusted-host https://download.pytorch.org
 
+protobuf==3.19.4
 torch
 torchvision
 -e .