···11+//
22+// ErrorHandling.swift
33+// shortcut
44+//
55+// Created by Bailey Townsend on 6/29/25.
66+//
77+import Foundation
88+99+enum GenericIntentError: Error, CustomLocalizedStringResourceConvertible, LocalizedError {
1010+ case general
1111+ case message(_ message: String)
1212+ case notFound(_ lostItem: String)
1313+1414+ var localizedStringResource: LocalizedStringResource {
1515+ switch self {
1616+ case let .message(message): return "\(message)"
1717+ case .general: return "There was an error making the post."
1818+ case let .notFound(lostItem): return "\(lostItem) could not be found"
1919+ }
2020+ }
2121+}
+40
AtProtoBackup/JSONResponseSection.swift
···11+//
22+// JSONResponseSection.swift
33+// AtProtoBackup
44+//
55+// Created by Corey Alexander on 8/25/25.
66+//
77+88+import SwiftUI
99+1010+struct JSONResponseSection: View {
1111+ let jsonData: Data?
1212+1313+ var body: some View {
1414+ if let jsonData = jsonData {
1515+ VStack(alignment: .leading, spacing: 8) {
1616+ Text("JSON Response:")
1717+ .font(.headline)
1818+1919+ ScrollView {
2020+ if let jsonObject = try? JSONSerialization.jsonObject(with: jsonData),
2121+ let prettyData = try? JSONSerialization.data(withJSONObject: jsonObject, options: [.prettyPrinted]),
2222+ let prettyString = String(data: prettyData, encoding: .utf8) {
2323+ Text(prettyString)
2424+ .font(.system(.body, design: .monospaced))
2525+ .textSelection(.enabled)
2626+ .padding()
2727+ .background(Color.gray.opacity(0.1))
2828+ .cornerRadius(8)
2929+ } else {
3030+ Text("Unable to decode JSON data")
3131+ .foregroundColor(.secondary)
3232+ }
3333+ }
3434+ }
3535+ } else {
3636+ Text("No JSON response available")
3737+ .foregroundColor(.secondary)
3838+ }
3939+ }
4040+}