1 /* 2 * Hunt - A redis client library for D programming language. 3 * 4 * Copyright (C) 2018-2019 HuntLabs 5 * 6 * Website: https://www.huntlabs.net/ 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 12 module hunt.redis.Exceptions; 13 14 import hunt.Exceptions; 15 16 import hunt.redis.HostAndPort; 17 18 class RedisException : RuntimeException { 19 mixin BasicExceptionCtors; 20 } 21 22 class InvalidURIException : RedisException { 23 mixin BasicExceptionCtors; 24 } 25 26 class RedisConnectionException : RedisException { 27 mixin BasicExceptionCtors; 28 } 29 30 class RedisExhaustedPoolException : RedisException { 31 mixin BasicExceptionCtors; 32 } 33 34 class RedisNoReachableClusterNodeException : RedisConnectionException { 35 mixin BasicExceptionCtors; 36 } 37 38 class RedisClusterOperationException : RedisException { 39 mixin BasicExceptionCtors; 40 } 41 42 class RedisDataException : RedisException { 43 mixin BasicExceptionCtors; 44 } 45 46 class RedisBusyException : RedisDataException { 47 mixin BasicExceptionCtors; 48 } 49 50 class RedisClusterException : RedisDataException { 51 mixin BasicExceptionCtors; 52 } 53 54 class RedisNoScriptException : RedisDataException { 55 mixin BasicExceptionCtors; 56 } 57 58 59 class RedisClusterMaxAttemptsException : RedisClusterOperationException { 60 mixin BasicExceptionCtors; 61 } 62 63 class RedisRedirectionException : RedisDataException { 64 65 private HostAndPort targetNode; 66 private int slot; 67 68 this(string message, HostAndPort targetNode, int slot) { 69 super(message); 70 this.targetNode = targetNode; 71 this.slot = slot; 72 } 73 74 this(Throwable cause, HostAndPort targetNode, int slot) { 75 super(cause); 76 this.targetNode = targetNode; 77 this.slot = slot; 78 } 79 80 this(string message, Throwable cause, HostAndPort targetNode, int slot) { 81 super(message, cause); 82 this.targetNode = targetNode; 83 this.slot = slot; 84 } 85 86 HostAndPort getTargetNode() { 87 return targetNode; 88 } 89 90 int getSlot() { 91 return slot; 92 } 93 } 94 95 class RedisMovedDataException : RedisRedirectionException { 96 this(string message, HostAndPort targetNode, int slot) { 97 super(message, targetNode, slot); 98 } 99 100 this(Throwable cause, HostAndPort targetNode, int slot) { 101 super(cause, targetNode, slot); 102 } 103 104 this(string message, Throwable cause, HostAndPort targetNode, int slot) { 105 super(message, cause, targetNode, slot); 106 } 107 } 108 109 class RedisAskDataException : RedisRedirectionException { 110 this(Throwable cause, HostAndPort targetHost, int slot) { 111 super(cause, targetHost, slot); 112 } 113 114 this(string message, Throwable cause, HostAndPort targetHost, int slot) { 115 super(message, cause, targetHost, slot); 116 } 117 118 this(string message, HostAndPort targetHost, int slot) { 119 super(message, targetHost, slot); 120 } 121 }