Skip to content

Commit 17c5c6f

Browse files
authored
Add RESPDecodeError typed throws where we can (#266)
1 parent e64249b commit 17c5c6f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Sources/Valkey/RESP/RESPTokenDecodable.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extension RESPToken: RESPTokenDecodable {
4747

4848
extension ByteBuffer: RESPTokenDecodable {
4949
@inlinable
50-
public init(fromRESP token: RESPToken) throws {
50+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
5151
switch token.value {
5252
case .simpleString(let buffer),
5353
.bulkString(let buffer),
@@ -76,7 +76,7 @@ extension ByteBuffer: RESPTokenDecodable {
7676

7777
extension String: RESPTokenDecodable {
7878
@inlinable
79-
public init(fromRESP token: RESPToken) throws {
79+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
8080
switch token.value {
8181
case .simpleString(let buffer),
8282
.bulkString(let buffer),
@@ -110,7 +110,7 @@ extension String: RESPTokenDecodable {
110110
}
111111

112112
extension Int64: RESPTokenDecodable {
113-
public init(fromRESP token: RESPToken) throws {
113+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
114114
switch token.value {
115115
case .number(let value):
116116
self = value
@@ -141,7 +141,7 @@ extension Int64: RESPTokenDecodable {
141141

142142
extension Int: RESPTokenDecodable {
143143
@inlinable
144-
public init(fromRESP token: RESPToken) throws {
144+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
145145
switch token.value {
146146
case .number(let value):
147147
guard let value = Int(exactly: value) else {
@@ -175,7 +175,7 @@ extension Int: RESPTokenDecodable {
175175

176176
extension Double: RESPTokenDecodable {
177177
@inlinable
178-
public init(fromRESP token: RESPToken) throws {
178+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
179179
switch token.value {
180180
case .double(let value):
181181
self = value
@@ -200,7 +200,7 @@ extension Double: RESPTokenDecodable {
200200

201201
extension Bool: RESPTokenDecodable {
202202
@inlinable
203-
public init(fromRESP token: RESPToken) throws {
203+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
204204
switch token.value {
205205
case .boolean(let value):
206206
self = value
@@ -295,7 +295,7 @@ extension ClosedRange: RESPTokenDecodable where Bound: RESPTokenDecodable {
295295

296296
extension RESPToken.Array: RESPTokenDecodable {
297297
@inlinable
298-
public init(fromRESP token: RESPToken) throws {
298+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
299299
switch token.value {
300300
case .array(let respArray), .set(let respArray), .push(let respArray):
301301
self = respArray
@@ -391,7 +391,7 @@ extension RESPToken.Array: RESPTokenDecodable {
391391

392392
extension RESPToken.Map: RESPTokenDecodable {
393393
@inlinable
394-
public init(fromRESP token: RESPToken) throws {
394+
public init(fromRESP token: RESPToken) throws(RESPDecodeError) {
395395
switch token.value {
396396
case .map(let respArray):
397397
self = respArray

0 commit comments

Comments
 (0)