Skip to content

Commit

Permalink
🐛 Add return values to all api messages
Browse files Browse the repository at this point in the history
  • Loading branch information
soyrubio committed Oct 8, 2024
1 parent 84e7da7 commit 070e0e6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wake/lsp/sake.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,11 @@ async def connect_chain(
raise LspError(ErrorCodes.InternalError, str(e)) from None

@chain_connected
async def disconnect_chain(self, params: SakeParams) -> None:
async def disconnect_chain(self, params: SakeParams) -> SakeResult:
try:
self.chains[params.session_id][1].__exit__(None, None, None)
del self.chains[params.session_id]
return SakeResult(success=True)
except Exception as e:
raise LspError(ErrorCodes.InternalError, str(e)) from None

Expand Down Expand Up @@ -296,7 +297,7 @@ async def dump_state(self, params: SakeParams) -> SakeDumpStateResult:
raise LspError(ErrorCodes.InternalError, str(e)) from None

@chain_connected
async def load_state(self, params: SakeLoadStateParams) -> None:
async def load_state(self, params: SakeLoadStateParams) -> SakeResult:
chain = self.chains[params.session_id][0]

if not isinstance(chain.chain_interface, AnvilChainInterface):
Expand All @@ -317,6 +318,7 @@ async def load_state(self, params: SakeLoadStateParams) -> None:
wake.development.core.Library(Address(addr), chain)
for addr in addrs
]
return SakeResult(success=True)
except Exception as e:
raise LspError(ErrorCodes.InternalError, str(e)) from None

Expand Down Expand Up @@ -697,10 +699,11 @@ async def set_balances(
raise LspError(ErrorCodes.InternalError, str(e)) from None

@chain_connected
async def set_label(self, params: SakeSetLabelParams) -> None:
async def set_label(self, params: SakeSetLabelParams) -> SakeResult:
chain = self.chains[params.session_id][0]

try:
Account(params.address, chain=chain).label = params.label
return SakeResult(success=True)
except Exception as e:
raise LspError(ErrorCodes.InternalError, str(e)) from None

0 comments on commit 070e0e6

Please sign in to comment.