1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
//! ReQL Error Messages //! //! These are the error messages returned by the driver. See their [documentation] for details. //! //! [documentation]: https://www.rethinkdb.com/docs/error-types/ /// The most generic error message in ReQL #[derive(Debug)] pub enum ReqlError { Compile(ReqlCompileError), Runtime(ReqlRuntimeError), Driver(ReqlDriverError), } impl From<ReqlCompileError> for ReqlError { fn from(err: ReqlCompileError) -> ReqlError { ReqlError::Compile(err) } } impl From<ReqlRuntimeError> for ReqlError { fn from(err: ReqlRuntimeError) -> ReqlError { ReqlError::Runtime(err) } } impl From<ReqlDriverError> for ReqlError { fn from(err: ReqlDriverError) -> ReqlError { ReqlError::Driver(err) } } /// The query cannot be compiled by the server /// /// This may be due to a syntax error, such as an unrecognized optional argument, or specifying the /// wrong number of arguments to a command. #[derive(Debug)] pub enum ReqlCompileError {} /// The parent class of all runtime errors /// /// All errors on the server unrelated to compilation. Programs may use this to catch any runtime /// error, but the server will always return a more specific error class. #[derive(Debug)] pub enum ReqlRuntimeError { QueryLogic(ReqlQueryLogicError), ResourceLimit(ReqlResourceLimitError), User(ReqlUserError), Internal(ReqlInternalError), Timeout(ReqlTimeoutError), Availability(ReqlAvailabilityError), Permissions(ReqlPermissionsError), } /// The query contains a logical impossibility, such as adding a number to a string. #[derive(Debug)] pub enum ReqlQueryLogicError { NonExistence(ReqlNonExistenceError), } /// A `ReqlQueryLogicError` that results from accessing a non-existent field or something else that /// can be handled with the default command. #[derive(Debug)] pub enum ReqlNonExistenceError {} /// Query execution caused a resource limit (for example, the array size limit) to be exceeded. #[derive(Debug)] pub enum ReqlResourceLimitError {} /// An error produced by the error command. #[derive(Debug)] pub enum ReqlUserError {} /// Query execution stopped due to an internal error, i.e., a server bug. #[derive(Debug)] pub enum ReqlInternalError {} /// The query has timed out /// /// This error happens on the client, not the server. Depending on driver implementation it may /// derive from a native error class rather than `ReqlError`. #[derive(Debug)] pub enum ReqlTimeoutError {} /// A server in the cluster is unavailable /// /// The parent class of `ReqlOpFailedError` and `ReqlOpIndeterminateError`. Programs may use this /// to catch any availability error, but the server will always return one of this class’s /// children. #[derive(Debug)] pub enum ReqlAvailabilityError { OpFailed(ReqlOpFailedError), OpIndeterminate(ReqlOpIndeterminateError), } /// The operation has failed due to cluster state, configuration or table availability. #[derive(Debug)] pub enum ReqlOpFailedError {} /// The status of the operation cannot be verified due to cluster state, configuration or table /// availability. #[derive(Debug)] pub enum ReqlOpIndeterminateError {} /// The user account does not have the permissions necessary to execute the query. #[derive(Debug)] pub enum ReqlPermissionsError {} /// An error has occurred within the driver /// /// This may be a driver bug, or it may be an unfulfillable command, such as an unserializable /// query. #[derive(Debug)] pub enum ReqlDriverError { Auth(ReqlAuthError), } /// The client failed authentication with the server. #[derive(Debug)] pub enum ReqlAuthError {}