taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit fe01d878e7601400eb30256c7ffc62e407d73259
parent b39e1adaeac143c9397bfb724dd5ba177160f511
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 13 Jul 2024 18:22:59 +0200

Error+debugDescription

Diffstat:
MTalerWallet.xcodeproj/project.pbxproj | 6++++++
ATalerWallet1/Helper/Error+debugDescription.swift | 30++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/TalerWallet.xcodeproj/project.pbxproj b/TalerWallet.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 4E0A71142C396D86002485BB /* Error+debugDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0A71132C396D86002485BB /* Error+debugDescription.swift */; }; + 4E0A71152C396D86002485BB /* Error+debugDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0A71132C396D86002485BB /* Error+debugDescription.swift */; }; 4E0A71182C3AB099002485BB /* IconBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0A71172C3AB099002485BB /* IconBadge.swift */; }; 4E0A71192C3AB099002485BB /* IconBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E0A71172C3AB099002485BB /* IconBadge.swift */; }; 4E16E12329F3BB99008B9C86 /* CurrencySpecification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E16E12229F3BB99008B9C86 /* CurrencySpecification.swift */; }; @@ -338,6 +340,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 4E0A71132C396D86002485BB /* Error+debugDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+debugDescription.swift"; sourceTree = "<group>"; }; 4E0A71172C3AB099002485BB /* IconBadge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconBadge.swift; sourceTree = "<group>"; }; 4E16E12229F3BB99008B9C86 /* CurrencySpecification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrencySpecification.swift; sourceTree = "<group>"; }; 4E2254952A822B8100E41D29 /* payment_received.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = payment_received.m4a; sourceTree = "<group>"; }; @@ -664,6 +667,7 @@ 4EB095072989CB7C0043A8A1 /* TalerStrings.swift */, 4E3EAEA72AA70157009F1BE8 /* Binding+onChange.swift */, 4E3EAE8B2AA0933C009F1BE8 /* Font+Taler.swift */, + 4E0A71132C396D86002485BB /* Error+debugDescription.swift */, 4EB095082989CB7C0043A8A1 /* View+dismissTop.swift */, 4E605DB62AB05E48002FB9A7 /* View+flippedDirection.swift */, 4E4F60A72C3BBF9F003BB669 /* View+Condition.swift */, @@ -1203,6 +1207,7 @@ 4E3EAE3E2A990778009F1BE8 /* ManualDetailsV.swift in Sources */, 4E3EAE3F2A990778009F1BE8 /* View+dismissTop.swift in Sources */, 4E3EAE402A990778009F1BE8 /* TransactionsListView.swift in Sources */, + 4E0A71142C396D86002485BB /* Error+debugDescription.swift in Sources */, 4E3EAE412A990778009F1BE8 /* WalletBackendRequest.swift in Sources */, 4E3EAE422A990778009F1BE8 /* KeyboardResponder.swift in Sources */, 4E3EAE432A990778009F1BE8 /* TransactionRowView.swift in Sources */, @@ -1328,6 +1333,7 @@ 4E6EDD852A3615BE0031D520 /* ManualDetailsV.swift in Sources */, 4EB0950B2989CB7C0043A8A1 /* View+dismissTop.swift in Sources */, 4EB095562989CBFE0043A8A1 /* TransactionsListView.swift in Sources */, + 4E0A71152C396D86002485BB /* Error+debugDescription.swift in Sources */, 4EB0951F2989CBCB0043A8A1 /* WalletBackendRequest.swift in Sources */, 4EAD117629F672FA008EDD0B /* KeyboardResponder.swift in Sources */, 4EB095572989CBFE0043A8A1 /* TransactionRowView.swift in Sources */, diff --git a/TalerWallet1/Helper/Error+debugDescription.swift b/TalerWallet1/Helper/Error+debugDescription.swift @@ -0,0 +1,30 @@ +/* MIT License + * Copyright (c) 2018 Rich Infante + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +import Foundation + +// (Swift 4) Extension to Error that allows for better debugging info than localizedDescription. +// https://www.richinfante.com/2018/01/25/demystifying-swift-errors +extension Error { + var debugDescription: String { + return "\(String(describing: type(of: self))).\(String(describing: self)) (code \((self as NSError).code))" + } +}