-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathVapiError.swift
More file actions
36 lines (33 loc) · 922 Bytes
/
VapiError.swift
File metadata and controls
36 lines (33 loc) · 922 Bytes
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
//
// VapiError.swift
//
//
// Created by Andrew Carter on 12/13/23.
//
import Foundation
public enum VapiError: LocalizedError {
case invalidURL
case customError(String)
case existingCallInProgress
case noCallInProgress
case decodingError(message: String, response: String? = nil)
case invalidJsonData
}
extension VapiError {
public var errorDescription: String? {
switch self {
case .invalidURL:
return "URL is invalid"
case .customError(let message):
return message
case .existingCallInProgress:
return "An existing call is in progress"
case .noCallInProgress:
return "No call in progress"
case .decodingError(let message, let response):
return "\(message), \(response ?? "no response")"
case .invalidJsonData:
return "Invalid JSON data"
}
}
}