Page
Library
Module
Module type
Parameter
Class
Class type
Source
Proton.ErrorsSourceException definitions for the Timeplus Proton OCaml driver. This module defines custom exceptions that can be raised during client-server communication and query execution.
All exceptions are automatically registered with the OCaml runtime to provide meaningful error messages when printed.
Network_error message is raised when network communication fails.
This exception indicates problems with the underlying network connection, such as connection loss, DNS resolution failures, or I/O errors.
Example:
try Client.execute client "SELECT 1"
with Network_error msg -> Printf.eprintf "Network failed: %s\n" msgSocket_timeout is raised when a socket operation times out.
Indicates that a read or write operation on the socket did not complete within the configured timeout period.
Example:
try Client.execute client "SELECT sleep(100)"
with Socket_timeout -> Printf.eprintf "Query timed out\n"Unexpected_packet description is raised when an unexpected packet type is received.
This exception indicates a protocol violation where the server sent a packet type that was not expected in the current context.
Example:
try Client.execute client "SELECT 1"
with Unexpected_packet desc -> Printf.eprintf "Protocol error: %s\n" descUnknown_packet packet_id is raised when an unrecognized packet ID is received.
Indicates that the server sent a packet with an ID that is not defined in the protocol specification known to this client.
exception Server_exception of {code : int;Numeric error code from the server
*)message : string;Primary error message describing the problem
*)nested : string option;Optional nested exception message providing additional context
*)}Server_exception represents an error reported by the Proton server.
When the server encounters an error during query processing, it sends an exception packet with error details. This exception captures that server-side error information.
The error code typically indicates the type of error (syntax error, table not found, permission denied, etc.), while the message provides a human-readable description.
Example:
try Client.execute client "SELECT * FROM nonexistent_table"
with Server_exception { code; message; nested } -> (
Printf.eprintf "Server error %d: %s\n" code message;
match nested with Some n -> Printf.eprintf "Caused by: %s\n" n | None -> ())