@@ -302,7 +302,7 @@ public actor AuthClient {
302
302
private func _signUp( body: SignUpRequest , query: Parameters ? = nil ) async throws ( AuthError)
303
303
-> AuthResponse
304
304
{
305
- let response = try await wrappingError {
305
+ let response = try await wrappingError ( or : mapToAuthError ) {
306
306
try await self . api. execute (
307
307
self . configuration. url. appendingPathComponent ( " signup " ) ,
308
308
method: . post,
@@ -398,7 +398,7 @@ public actor AuthClient {
398
398
grantType: String ,
399
399
credentials: Credentials
400
400
) async throws ( AuthError) -> Session {
401
- let session = try await wrappingError {
401
+ let session = try await wrappingError ( or : mapToAuthError ) {
402
402
try await self . api. execute (
403
403
self . configuration. url. appendingPathComponent ( " token " ) ,
404
404
method: . post,
@@ -435,7 +435,7 @@ public actor AuthClient {
435
435
) async throws ( AuthError) {
436
436
let ( codeChallenge, codeChallengeMethod) = prepareForPKCE ( )
437
437
438
- _ = try await wrappingError {
438
+ _ = try await wrappingError ( or : mapToAuthError ) {
439
439
try await self . api. execute (
440
440
self . configuration. url. appendingPathComponent ( " otp " ) ,
441
441
method: . post,
@@ -474,7 +474,7 @@ public actor AuthClient {
474
474
data: [ String : AnyJSON ] ? = nil ,
475
475
captchaToken: String ? = nil
476
476
) async throws ( AuthError) {
477
- _ = try await wrappingError {
477
+ _ = try await wrappingError ( or : mapToAuthError ) {
478
478
try await self . api. execute (
479
479
self . configuration. url. appendingPathComponent ( " otp " ) ,
480
480
method: . post,
@@ -504,7 +504,7 @@ public actor AuthClient {
504
504
) async throws ( AuthError) -> SSOResponse {
505
505
let ( codeChallenge, codeChallengeMethod) = prepareForPKCE ( )
506
506
507
- return try await wrappingError {
507
+ return try await wrappingError ( or : mapToAuthError ) {
508
508
try await self . api. execute (
509
509
self . configuration. url. appendingPathComponent ( " sso " ) ,
510
510
method: . post,
@@ -536,7 +536,7 @@ public actor AuthClient {
536
536
) async throws ( AuthError) -> SSOResponse {
537
537
let ( codeChallenge, codeChallengeMethod) = prepareForPKCE ( )
538
538
539
- return try await wrappingError {
539
+ return try await wrappingError ( or : mapToAuthError ) {
540
540
try await self . api. execute (
541
541
self . configuration. url. appendingPathComponent ( " sso " ) ,
542
542
method: . post,
@@ -564,7 +564,7 @@ public actor AuthClient {
564
564
)
565
565
}
566
566
567
- let session = try await wrappingError {
567
+ let session = try await wrappingError ( or : mapToAuthError ) {
568
568
try await self . api. execute (
569
569
self . configuration. url. appendingPathComponent ( " token " ) ,
570
570
method: . post,
@@ -598,7 +598,7 @@ public actor AuthClient {
598
598
redirectTo: URL ? = nil ,
599
599
queryParams: [ ( name: String , value: String ? ) ] = [ ]
600
600
) throws ( AuthError) -> URL {
601
- try wrappingError {
601
+ try wrappingError ( or : mapToAuthError ) {
602
602
try self . getURLForProvider (
603
603
url: self . configuration. url. appendingPathComponent ( " authorize " ) ,
604
604
provider: provider,
@@ -639,7 +639,7 @@ public actor AuthClient {
639
639
let resultURL = try await launchFlow ( url)
640
640
return try await session ( from: resultURL)
641
641
} catch {
642
- throw mapError ( error)
642
+ throw mapToAuthError ( error)
643
643
}
644
644
}
645
645
@@ -784,7 +784,7 @@ public actor AuthClient {
784
784
785
785
let params = extractParams ( from: url)
786
786
787
- return try await wrappingError {
787
+ return try await wrappingError ( or : mapToAuthError ) {
788
788
switch self . configuration. flowType {
789
789
case . implicit:
790
790
guard self . isImplicitGrantFlow ( params: params) else {
@@ -932,7 +932,7 @@ public actor AuthClient {
932
932
}
933
933
934
934
do {
935
- try await wrappingError {
935
+ try await wrappingError ( or : mapToAuthError ) {
936
936
_ = try await self . api. execute (
937
937
self . configuration. url. appendingPathComponent ( " logout " ) ,
938
938
method: . post,
@@ -1009,7 +1009,7 @@ public actor AuthClient {
1009
1009
query: Parameters ? = nil ,
1010
1010
body: VerifyOTPParams
1011
1011
) async throws ( AuthError) -> AuthResponse {
1012
- let response = try await wrappingError {
1012
+ let response = try await wrappingError ( or : mapToAuthError ) {
1013
1013
try await self . api. execute (
1014
1014
self . configuration. url. appendingPathComponent ( " verify " ) ,
1015
1015
method: . post,
@@ -1038,7 +1038,7 @@ public actor AuthClient {
1038
1038
emailRedirectTo: URL ? = nil ,
1039
1039
captchaToken: String ? = nil
1040
1040
) async throws ( AuthError) {
1041
- _ = try await wrappingError {
1041
+ _ = try await wrappingError ( or : mapToAuthError ) {
1042
1042
try await self . api. execute (
1043
1043
self . configuration. url. appendingPathComponent ( " resend " ) ,
1044
1044
method: . post,
@@ -1068,7 +1068,7 @@ public actor AuthClient {
1068
1068
type: ResendMobileType ,
1069
1069
captchaToken: String ? = nil
1070
1070
) async throws ( AuthError) -> ResendMobileResponse {
1071
- return try await wrappingError {
1071
+ return try await wrappingError ( or : mapToAuthError ) {
1072
1072
try await self . api. execute (
1073
1073
self . configuration. url. appendingPathComponent ( " resend " ) ,
1074
1074
method: . post,
@@ -1085,7 +1085,7 @@ public actor AuthClient {
1085
1085
1086
1086
/// Sends a re-authentication OTP to the user's email or phone number.
1087
1087
public func reauthenticate( ) async throws ( AuthError) {
1088
- _ = try await wrappingError {
1088
+ _ = try await wrappingError ( or : mapToAuthError ) {
1089
1089
try await self . api. execute (
1090
1090
self . configuration. url. appendingPathComponent ( " reauthenticate " ) ,
1091
1091
method: . get,
@@ -1104,7 +1104,7 @@ public actor AuthClient {
1104
1104
///
1105
1105
/// Should be used only when you require the most current user data. For faster results, ``currentUser`` is recommended.
1106
1106
public func user( jwt: String ? = nil ) async throws ( AuthError) -> User {
1107
- return try await wrappingError {
1107
+ return try await wrappingError ( or : mapToAuthError ) {
1108
1108
if let jwt {
1109
1109
return try await self . api. execute (
1110
1110
self . configuration. url. appendingPathComponent ( " user " ) ,
@@ -1139,7 +1139,7 @@ public actor AuthClient {
1139
1139
user. codeChallengeMethod = codeChallengeMethod
1140
1140
}
1141
1141
1142
- return try await wrappingError {
1142
+ return try await wrappingError ( or : mapToAuthError ) {
1143
1143
var session = try await self . sessionManager. session ( )
1144
1144
let updatedUser = try await self . api. execute (
1145
1145
self . configuration. url. appendingPathComponent ( " user " ) ,
@@ -1256,7 +1256,7 @@ public actor AuthClient {
1256
1256
redirectTo: URL ? = nil ,
1257
1257
queryParams: [ ( name: String , value: String ? ) ] = [ ]
1258
1258
) async throws ( AuthError) -> OAuthResponse {
1259
- try await wrappingError {
1259
+ try await wrappingError ( or : mapToAuthError ) {
1260
1260
let url = try self . getURLForProvider (
1261
1261
url: self . configuration. url. appendingPathComponent ( " user/identities/authorize " ) ,
1262
1262
provider: provider,
@@ -1287,7 +1287,7 @@ public actor AuthClient {
1287
1287
/// Unlinks an identity from a user by deleting it. The user will no longer be able to sign in
1288
1288
/// with that identity once it's unlinked.
1289
1289
public func unlinkIdentity( _ identity: UserIdentity ) async throws ( AuthError) {
1290
- _ = try await wrappingError {
1290
+ _ = try await wrappingError ( or : mapToAuthError ) {
1291
1291
try await self . api. execute (
1292
1292
self . configuration. url. appendingPathComponent ( " user/identities/ \( identity. identityId) " ) ,
1293
1293
method: . delete,
@@ -1308,7 +1308,7 @@ public actor AuthClient {
1308
1308
) async throws ( AuthError) {
1309
1309
let ( codeChallenge, codeChallengeMethod) = prepareForPKCE ( )
1310
1310
1311
- _ = try await wrappingError {
1311
+ _ = try await wrappingError ( or : mapToAuthError ) {
1312
1312
try await self . api. execute (
1313
1313
self . configuration. url. appendingPathComponent ( " recover " ) ,
1314
1314
method: . post,
@@ -1337,7 +1337,7 @@ public actor AuthClient {
1337
1337
throw AuthError . sessionMissing
1338
1338
}
1339
1339
1340
- return try await wrappingError {
1340
+ return try await wrappingError ( or : mapToAuthError ) {
1341
1341
try await self . sessionManager. refreshSession ( refreshToken)
1342
1342
}
1343
1343
}
0 commit comments