Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5be4c97a
authored
Jun 03, 2026
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add debug logging and improve error handling in print_text function
1 parent
7e2adadc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
opensipkd/base/views/printers.py
opensipkd/base/views/printers.py
View file @
5be4c97
...
...
@@ -221,6 +221,7 @@ class Views(BaseView):
async
def
print_text
(
user_id
=
None
,
print_id
=
None
,
text
=
None
,
filename
=
None
,
ws_url
=
BASE_CLASS
.
wsp_url
):
log
.
debug
(
f
"Starting print_text with user_id={user_id}, print_id={print_id}, filename={filename}"
)
if
not
user_id
and
not
print_id
:
log
.
error
(
"User ID or Print ID must be provided."
)
raise
Exception
(
"User ID or Print ID must be provided."
)
...
...
@@ -299,8 +300,9 @@ async def print_text(user_id=None, print_id=None, text=None, filename=None,
return
data
except
(
websockets
.
ConnectionClosed
,
ConnectionRefusedError
,
OSError
)
as
e
:
raise
Exception
(
f
"Failed to connect to WebSocket server: {e}"
)
from
e
msg
=
f
"Failed to connect to WebSocket server at {ws_url}: {e}"
log
.
error
(
msg
)
raise
Exception
(
msg
)
from
e
# Replace with your printer's IP
ip
=
printer
.
kode
if
printer
else
"127.0.0.1"
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment