Exceptions
abb_rws_client_python_rw6.core.exceptions
Custom exceptions for abb_rws_client_python_rw6.
Author: Clement RACINET
Exception hierarchy::
RWSError ← base class, always catchable with a single except
├── RWSConnectionError ← unreachable network / TCP timeout
├── RWSTimeoutError ← HTTP timeout exceeded
├── RWSAuthenticationError ← persistent 401 after digest handshake
├── RWSHTTPError ← any HTTP response >= 400 not covered above
│ └── RWSNotFoundError ← 404 (variable / resource not found)
├── MastershipError ← base class for mastership errors
│ ├── MastershipDenied ← controller refuses mastership acquisition
│ └── MastershipNotHeld ← write attempt without an active mastership
└── RWSValueError ← invalid RAPID value / serialization failure
CTRL_CODES
Complete dictionary of ABB RobotWare 6 return codes.
Source: robot_controller_return_code.xml (RWS API documentation).
Key : integer code (positive = success, negative = error)
Value: ABB symbolic name (e.g. "SYS_CTRL_E_MASTER_REJECT")
MastershipDenied
Bases: MastershipError
The controller refused the mastership acquisition request.
Typical causes:
- The RAPID program is running in automatic mode.
- Another client already holds mastership.
- The UAS denies access for this user.
ABB constraint: SYS_CTRL_E_MASTER_REJECT (code -1073445859).
Example
>>> try:
... await client.post("rw/mastership", params={"action": "request"})
... except MastershipDenied:
... print("Mastership denied by controller")
Source code in abb_rws_client_python_rw6/core/exceptions.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
MastershipError
Bases: RWSError
Base class for RAPID mastership-related errors.
Example
>>> try:
... await client.post("rw/mastership", params={"action": "request"})
... except MastershipError:
... print("Mastership operation failed")
Source code in abb_rws_client_python_rw6/core/exceptions.py
427 428 429 430 431 432 433 434 435 436 437 | |
MastershipNotHeld
Bases: MastershipError
Write operation attempted without an active mastership.
Raised client-side before the HTTP request is even sent, as a guard against out-of-order calls.
Example
>>> try:
... await set_rapid_variable(client, ...)
... except MastershipNotHeld:
... print("Acquire mastership first")
Source code in abb_rws_client_python_rw6/core/exceptions.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
RWSAuthenticationError
Bases: RWSError
Digest authentication refused (persistent HTTP 401).
Indicates incorrect credentials or a user not authorised in the controller's UAS (User Authorization System).
Example
>>> try:
... await client.get("rw/rapid/execution")
... except RWSAuthenticationError:
... print("Invalid credentials")
Source code in abb_rws_client_python_rw6/core/exceptions.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
RWSConnectionError
Bases: RWSError
Cannot establish a TCP connection to the controller.
Raised when httpx.ConnectError or httpx.ConnectTimeout is caught
after all retries have been exhausted.
Example
>>> try:
... await client.get("rw/rapid/execution")
... except RWSConnectionError:
... print("Controller unreachable")
Source code in abb_rws_client_python_rw6/core/exceptions.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
RWSError
Bases: Exception
Base class for all RWS errors.
All exceptions raised by this library inherit from RWSError,
allowing callers to catch every library error with a single
except RWSError clause.
| Attributes: |
|
|---|
Example
>>> try:
... await client.get("rw/rapid/execution")
... except RWSError as exc:
... print(exc.message)
Source code in abb_rws_client_python_rw6/core/exceptions.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
RWSHTTPError
Bases: RWSError
Unexpected HTTP response (>= 400) not covered by a more specific exception.
| Attributes: |
|
|---|
Example
>>> try:
... await client.post("rw/rapid/execution", params={"action": "start"})
... except RWSHTTPError as exc:
... print(exc.ctrl_code_name)
Source code in abb_rws_client_python_rw6/core/exceptions.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
RWSNotFoundError
Bases: RWSHTTPError
RWS resource not found (HTTP 404).
Typically raised for a non-existent RAPID variable, incorrect module name, or unknown task.
| Attributes: |
|
|---|
Example
>>> try:
... await client.get("rw/rapid/symbol/data/RAPID/T_ROB1/MOD/MISSING")
... except RWSNotFoundError as exc:
... print(exc.resource)
Source code in abb_rws_client_python_rw6/core/exceptions.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
RWSTimeoutError
Bases: RWSError
The controller did not respond within the configured timeout.
Raised when httpx.ReadTimeout or httpx.PoolTimeout is caught
after all retries have been exhausted.
Example
>>> try:
... await client.get("rw/rapid/execution")
... except RWSTimeoutError:
... print("Request timed out")
Source code in abb_rws_client_python_rw6/core/exceptions.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
RWSValueError
Bases: RWSError
Invalid RAPID value or serialization / deserialization failure.
Raised by core/serializers.py when a Python value cannot be
converted to RWS format, or conversely when a raw RWS string cannot
be parsed into a Python type.
Example
>>> try:
... rws_to_robtarget("not_a_valid_robtarget")
... except RWSValueError as exc:
... print(exc.message)
Source code in abb_rws_client_python_rw6/core/exceptions.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | |
ctrl_code_name(code)
Return the ABB symbolic name for a return code, or its decimal representation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
>>> ctrl_code_name(-1073445859)
'SYS_CTRL_E_MASTER_REJECT'
>>> ctrl_code_name(0)
'UNKNOWN(0)'
Source code in abb_rws_client_python_rw6/core/exceptions.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |