Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Sources/YData/Core/Error/FabricError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Foundation

public protocol FabricError: Error, Codable {
var context: [String: String]? { get }
var description: String { get }
var httpCode: Int? { get }
var name: String { get }
var returnValue: Int { get }
}

public extension FabricError {
var name: String { "\(Self.self)" }
}
33 changes: 33 additions & 0 deletions Sources/YData/Core/Error/GenericFabricError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Foundation

public class GenericFabricError: FabricError {
public var context: [String: String]?
public var description: String
public var httpCode: Int?
var _name: String? // swiftlint:disable:this identifier_name
public var returnValue: Int

public var name: String {
get {
_name ?? "\(Self.self)"
}

set {
_name = newValue
}
}

init(
context: [String: String]? = nil,
description: String,
httpCode: Int? = nil,
name: String? = nil,
returnValue: Int
) {
self.context = context
self.description = description
self.httpCode = httpCode
self._name = name
self.returnValue = returnValue
}
}