| 1 | import * as Data from "effect/Data"; |
| 2 | |
| 3 | /** No `REDIS_URL` in the Function/Service environment. */ |
| 4 | export class UrlMissing extends Data.TaggedError("Redis.UrlMissing")<{ |
| 5 | name: string; |
| 6 | }> { |
| 7 | override get message() { |
| 8 | return `REDIS_URL missing for ${this.name}`; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | /** A Redis command failed (RESP error, socket, or protocol). */ |
| 13 | export class CommandError extends Data.TaggedError("Redis.CommandError")<{ |
| 14 | command: string; |
| 15 | cause: unknown; |
| 16 | }> {} |
| 17 | |
| 18 | /** Redis replied with a RESP error (`-ERR …`, `-WRONGTYPE …`). */ |
| 19 | export class ReplyError extends Data.TaggedError("Redis.ReplyError")<{ |
| 20 | readonly code: string; |
| 21 | readonly message: string; |
| 22 | }> {} |
| 23 | |
| 24 | /** Bytes on the wire were not valid RESP. */ |
| 25 | export class ProtocolError extends Data.TaggedError("Redis.ProtocolError")<{ |
| 26 | readonly message: string; |
| 27 | }> {} |