Q:
How to create
// ---------------
Q:
How can I inse
The present invent
1. Field of the In
Q:
Is there a way
1. Field of the In
Q:
When and how s
The present invent
Gastric mucosal pH/**
* (C) Copyright IBM Corp. 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/**
A human-readable error string for a specific SDK error. It contains a description of the error with the `reason` property extracted from the SDK error.
*/
public struct LogLevelError: Codable, Equatable {
/// Encoding key that points to an error object in the `Error` object
public let object: String
/// The reason of an error message
public let reason: String
/**
An error object that corresponds to an `Error` in SDK's `Error.Error` object.
This is meant to be used only in `NSError.localizedFailureReason` and `NSError.localizedDescription`.
- SeeAlso: `NSError.localizedDescription`
- SeeAlso: `NSError.localizedFailureReason`
- SeeAlso: `Error.Error`
- SeeAlso: `Error.Error`
*/
public var error: Error.Error {
return "error"
}
/**
Create an instance with `object`, the reason and the error object.
- Parameters:
- object: A human readable representation of the underlying error object.
- reason: The reason that the error string is created.
- error: An object to which the error is assigned.
- SeeAlso: `LogLevelError.error`
*/
public init(object: String, reason: String, error: Error.Error? = nil) {
self.object = object
self.reason = reason
self.error = error ?? error
}
public init(from decoder: Decoder) throws {
let string = try decoder.singleValueContainer().decode(String.self)
self.object = string
self.reason = try decoder.singleValueContainer().decode(String.self)
self.error = try decoder.singleValueContainer().decode(Error.Error.self)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(object)
try container.encode(reason)
try container.encode(error)
}
public static func == (lhs: LogLevelError, rhs: LogLevelError) -> Bool {
return lhs.object == rhs.object && lhs.reason == rhs.reason
}
}