Skip to main content

Errors and timeouts

Every SDK raises the same set of failures under the same names, so a test bench can handle them the same way in any language.

The taxonomy​

MeaningPython / NodeJSRustC
Base type for all of themScanaStudioErrorError—
The connection went awayConnectionClosedError::Closedss_status_Disconnected
The server refused the commandProtocolError (with code)Error::Protocolss_status_Failed
Nothing answered in timeTimeoutError::Timeoutss_status_Timeout
The server speaks another protocolVersionMismatchError::VersionNULL from ss_server_connect
The device could not do itRefusedError::Refusedss_status_Refused
The workspace is frozen by an exportBusyError::Busyss_status_Failed
A script failed or rejected its configScriptError (with logs)Error::Scriptss_status_Failed
A file operation failedIoErrorError::Ioss_status_Failed
An option the script does not knowUnknownOption (with known)Error::UnknownOptionss_status_BadArgument
A script-library operation failedScriptOpError——
from ikalogic_scanastudio import (
ScanaStudio, ScanaStudioError, Refused, ScriptError, Timeout, VersionMismatch,
)

try:
with ScanaStudio.connect() as server:
workspace = server.create("hw:SP259-000123")
workspace.capture.run(samples=1_000_000, sample_rate=1_000_000_000)
except VersionMismatch as exc:
print(f"server speaks protocol {exc.spoken}, this SDK speaks {exc.supported}")
except Refused as exc:
print(f"the device would not do it: {exc}")
except ScriptError as exc:
print(exc)
for line in exc.logs: # the script's own output
print(" ", line)
except Timeout:
print("no answer in time")
except ScanaStudioError as exc:
print(f"something else went wrong: {exc}")

Protocol error codes​

When the server refuses a command outright it sends a stable code, meant to be matched on rather than parsed out of the message:

CodeMeaning
bad_messageThe command was unreadable, or names a command that does not exist. Usually an SDK/server version mismatch.
no_workspaceThe command needs a workspace and this connection is not attached to one.

Timeouts​

Every blocking call takes a timeout, and the defaults differ because the operations do:

OperationDefault
Any single request/answer30 s
Opening or attaching a workspace60 s
Waiting for a capture300 s
Waiting for decoding300 s
Waiting for measurements60 s
Save, load, export600 s

Python and Rust count seconds; NodeJS counts milliseconds, in a parameter named timeout_ms.

A timeout does not cancel the work

Timing out means you stopped waiting. The capture is still running, the export is still writing. Decide explicitly whether to stop() or to wait again, and remember the workspace is still there on the server either way.

Long captures need a long timeout, or none

A datalogger capture that runs for hours will exceed the 300 s default. Do not raise the timeout to match: start() without waiting, let the script exit, and come back later with attach(). See Headless datalogger.