Skip to content

Commit 52c0645

Browse files
snacksbrojourdain
authored andcommitted
feat(protocol): Use on_error lifecycle hook if defined by consumer
1 parent 6630fef commit 52c0645

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

trame_server/protocol.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ def life_cycle_update(self, name):
189189

190190
@exportRpc("trame.error.client")
191191
def js_error(self, message):
192-
print(f" JS Error => {message}")
192+
if self.server.controller.on_error.exists():
193+
self.server.controller.on_error(message)
194+
else:
195+
print(f" JS Error => {message}")
193196

194197
# ---------------------------------------------------------------
195198

0 commit comments

Comments
 (0)