11//
22// Errors.swift
3- //
3+ //
44//
55// Created by Igor on 08.03.2023.
66//
77
88import  Foundation
99
10- extension  ReplicateAPI { 
10+ extension  ReplicateAPI { 
1111
1212 /// Set of replicate API errors
1313 @available ( iOS 15 . 0 ,  macOS 12 . 0 ,  tvOS 15 . 0 ,  watchOS 8 . 0 ,  * )  
1414 public  enum  Errors :  Error ,  Hashable ,  LocalizedError  { 
15-  
15+ 1616 /// Base URL error
1717 case  baseURLError
1818
@@ -31,6 +31,9 @@ extension ReplicateAPI{
3131 /// Could not decode error format response
3232 case  couldNotDecodeErrorContainer
3333
34+  /// Client-specific error with a custom message
35+  case  clientError( String ) 
36+ 3437 /// Provides a localized description for each error case.
3538 public  var  errorDescription :  String ? { 
3639 switch  self  { 
@@ -51,6 +54,9 @@ extension ReplicateAPI{
5154
5255 case  . couldNotDecodeErrorContainer: 
5356 return  NSLocalizedString ( " Could not decode the error response. The format might be incorrect. " ,  comment:  " Decoding error " ) 
57+ 58+  case  . clientError( let  message) : 
59+  return  message
5460 } 
5561 } 
5662 } 
0 commit comments