Package Torello.Browser
Class RDPError
- java.lang.Object
-
- Torello.Browser.RDPError
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<RDPError>
public final class RDPError extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<RDPError>
Represents an Internal Java-Side Failure During WebSocket Communication
This class is used to represent errors that arise during the execution of internal logic within the Java-based infrastructure responsible for interacting with the Chrome DevTools Protocol (CDP) over WebSockets. It is the conceptual opposite ofBrowserError, which represents errors *reported by the browser itself*.
RDPErrorinstances are thrown or passed downstream whenever an unexpected or invalid condition is detected by the Java-side handlers that process inbound or outbound messages on the WebSocket channel.
These are *not* errors originating from the browser. Instead, they usually reflect one of the following situations:- Failures inside message-processing logic (e.g., malformed or unrecognized JSON)
- Unchecked runtime exceptions triggered by handler code (e.g., NPE, casting failures)
- Unexpected conditions raised by the NeoVisionaries WebSocket implementation
- Structural violations in expected CDP response formats
RDPErrorobjects can optionally include:- A textual message describing the failure
- The raw
JsonObjectthat caused the error (if applicable) - A
Throwablethat was caught and wrapped
Causing these Errors:
All instantiations of this class occur inside one of the four internal infrastructure classes:
Because these errors reflect misbehavior or malformation in Java-managed logic, they should never be ignored. They often signal bugs in parsing logic, protocol desynchronization, or incorrect assumptions in command/response handling.
Registering a Handler:
To receive instances of this error class, a handler must be registered at the time you create yourWebSocketSenderusing one of thecreateSender(...)methods found in eitherBrowserConnorPageConn. These methods allow you to provide lambda handlers or consumer functions for error callbacks. Without explicitly setting a handler for this error type, you will never see these errors—they will be silently discarded or ignored by the internal infrastructure.
Each of the three CDP error/response types —RDPError,BrowserError, andBrowserEvent— has its own dedicated handler. These are supplied asConsumerarguments tocreateSender(...), and any logic you wish to perform in response to these events must be defined there. TheWebSocketSenderwill invoke these handlers automatically whenever it receives a message of the corresponding kind.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/Browser/RDPError.java
- Open New Browser-Tab: Torello/Browser/RDPError.java
File Size: 8,982 Bytes Line Count: 233 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field protected static longserialVersionUIDInstance Fields Modifier and Type Field ThrowablecauseJsonObjectjoStringmessage
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable. Using theSerializableImplementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final long serialVersionUID = 1;
-
message
public final java.lang.String message
A descriptive message explaining the nature of the internal error.
This string is almost always provided by the handler logic itself to contextualize what went wrong — e.g., "Unrecognized ID field", "Unexpected type in CDP response", or "Missing 'method' property in event dispatch."- Code:
- Exact Field Declaration Expression:
public final String message;
-
cause
public final java.lang.Throwable cause
The underlying exception or cause that led to this RDPError.
This may includeNullPointerException,ClassCastException, or any other unchecked exception that occurred during handler execution. It may benullif the error was raised directly without an underlying Throwable.- Code:
- Exact Field Declaration Expression:
public final Throwable cause;
-
jo
public final JsonObject jo
The rawJsonObjectthat was being processed at the time the error occurred.
This field is useful for debugging. It often contains the browser's CDP response that the Java code failed to parse or recognize. It may benullif the failure was unrelated to message content (e.g., a runtime exception).- Code:
- Exact Field Declaration Expression:
public final JsonObject jo;
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Code:
- Exact Method Body:
final String jsonStr = (jo == null) ? " JSON: NULL" : (" JSON: \n" + PrintUtil.json2(jo)); final String causeStr = (cause == null) ? " Cause Throwable: NULL" : (" Cause: \n" + EXCC.toString(cause)); return "RDPError Object\n" + "{\n" + " Message: " + message + '\n' + jsonStr + '\n' + causeStr + '\n' + '}';
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- Code:
- Exact Method Body:
return message.hashCode();
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object- Code:
- Exact Method Body:
if (this == o) return true; if (o == null) return false; if (this.getClass() != o.getClass()) return false; final RDPError error = (RDPError) o; return (message.equals(error.message));
-
compareTo
-
-