Skip to content

Commit 1768d6b

Browse files
authored
Merge pull request #37 from UiPath/fix/handle_runtime_schema_errors
fix: handle runtime schema load errors
2 parents b8ba780 + f4a9e26 commit 1768d6b

4 files changed

Lines changed: 32 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-dev"
3-
version = "0.0.18"
3+
version = "0.0.19"
44
description = "UiPath Developer Console"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/dev/ui/panels/new_run_panel.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import json
44
from typing import Any, Tuple, cast
55

6+
from rich.text import Text
67
from textual.app import ComposeResult
78
from textual.containers import Container, Horizontal, Vertical
89
from textual.reactive import reactive
9-
from textual.widgets import Button, Select, TabbedContent, TabPane
10+
from textual.widgets import Button, Select, Static, TabbedContent, TabPane
1011
from uipath.runtime import UiPathRuntimeFactoryProtocol, UiPathRuntimeProtocol
1112

1213
from uipath.dev.ui.widgets.json_input import JsonInput
@@ -46,6 +47,12 @@ def compose(self) -> ComposeResult:
4647
allow_blank=True,
4748
)
4849

50+
yield Static(
51+
"",
52+
id="error-message",
53+
classes="error-message hidden",
54+
)
55+
4956
yield JsonInput(
5057
text=self.initial_input,
5158
language="json",
@@ -112,6 +119,13 @@ async def on_mount(self) -> None:
112119
async def _load_schema_and_update_input(self, entrypoint: str) -> None:
113120
"""Ensure schema for entrypoint is loaded, then update JSON input."""
114121
json_input = self.query_one("#json-input", JsonInput)
122+
error_message = self.query_one("#error-message", Static)
123+
select = self.query_one("#entrypoint-select", Select)
124+
125+
# Hide error, show input by default
126+
error_message.add_class("hidden")
127+
json_input.remove_class("hidden")
128+
select.remove_class("hidden")
115129

116130
if not entrypoint or entrypoint == "no-entrypoints":
117131
json_input.text = "{}"
@@ -131,12 +145,12 @@ async def _load_schema_and_update_input(self, entrypoint: str) -> None:
131145
self.entrypoint_schemas[entrypoint] = input_schema
132146
schema = input_schema
133147
except Exception as e:
134-
json_input.text = "{}"
135-
self.app.notify(
136-
f"Error loading schema for '{entrypoint}': {str(e)}",
137-
severity="error",
138-
timeout=5,
148+
json_input.add_class("hidden")
149+
select.add_class("hidden")
150+
error_message.update(
151+
Text(f"Error loading schema for '{entrypoint}':\n\n{str(e)}")
139152
)
153+
error_message.remove_class("hidden")
140154
return
141155
finally:
142156
if runtime is not None:

src/uipath/dev/ui/styles/terminal.tcss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ Screen {
129129
border: solid #ff4444;
130130
}
131131

132+
.error-message {
133+
color: $error;
134+
background: $surface;
135+
padding: 1 2;
136+
border: solid $error;
137+
height: auto;
138+
max-height: 50%;
139+
overflow-y: auto;
140+
}
141+
132142
.hidden {
133143
display: none;
134144
}

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)