<TRCValidationErrorPrinter> Protocol Reference

Implementation of this protocol let you print custom validation error description for your custom schema format. More...

Inheritance diagram for <TRCValidationErrorPrinter>:

Instance Methods

(NSString *) - errorDescriptionForObject:errorMessage:stackTrace:
 This method prints object with errorMessage string at specific path. More...
 

Detailed Description

Implementation of this protocol let you print custom validation error description for your custom schema format.

Each validation NSError has custom keys in dictionary which help to you debug the error. One of these keys is TyphoonRestClientErrorKeyFullDescription, and if want good error description you may implement that protocol and register for your scheme format, using method registerValidationErrorPrinter:forFormatWithFileExtension: (TyphoonRestClient(Infrastructure))

By default, error printer implemented only for JSON schema format

Method Documentation

◆ errorDescriptionForObject:errorMessage:stackTrace:()

- (NSString *) errorDescriptionForObject: (id)  object
errorMessage: (NSString *)  errorMessage
stackTrace: (NSArray *)  stackTrace 

This method prints object with errorMessage string at specific path.

for example for input: :

object = {
"key": {
"subkey": "value"
}
}
errorMessage = "value must be NSNumber, but NSString given"
stackTrace = @["key", @"subkey"]

The output would be:

{
"key": {
"subkey": "value" <--- value must be NSNumber, but NSString given
}
}
Parameters
objectinput object to print. Usually comes from response/request serialization
errorMessageerror string to print
stackTrace- array of identifiers, which means stack trace (path to element with error). For JSON/Plist format, stackTrace contains only NSNumber (means array index) and NSString (means dictionary key)
Returns
full description of error, with whole object and error message with pointer