diff --git a/vcx/wrappers/ios/vcx/utils/NSError+VcxError.m b/vcx/wrappers/ios/vcx/utils/NSError+VcxError.m index 56095a76fb..9c41e81da4 100644 --- a/vcx/wrappers/ios/vcx/utils/NSError+VcxError.m +++ b/vcx/wrappers/ios/vcx/utils/NSError+VcxError.m @@ -4,6 +4,8 @@ // #import "NSError+VcxError.h" +#import "vcx.h" +#include "vcx.h" static NSString *const VcxErrorDomain = @"VcxErrorDomain"; @@ -13,23 +15,23 @@ + (NSError*) errorFromVcxError:(vcx_error_t) error { NSMutableDictionary *userInfo = [NSMutableDictionary new]; - // if (error != Success) { - // const char * error_json_p; - // indy_get_current_error(&error_json_p); - // - // NSString *errorDetailsJson = [NSString stringWithUTF8String:error_json_p]; - // - // NSError *error; - // NSDictionary *errorDetails = [NSJSONSerialization JSONObjectWithData:[NSData dataWithBytes:[errorDetailsJson UTF8String] - // length:[errorDetailsJson length]] - // options:kNilOptions - // error: &error]; - // - // [userInfo setValue:errorDetails[@"error"] forKey:@"sdk_message"]; - // [userInfo setValue:errorDetails[@"message"] forKey:@"sdk_full_message"]; - // [userInfo setValue:errorDetails[@"cause"] forKey:@"sdk_cause"]; - // [userInfo setValue:errorDetails[@"backtrace"] forKey:@"sdk_backtrace"]; - // } + if (error != Success) { + const char * error_json_p; + vcx_get_current_error(&error_json_p); + + NSString *errorDetailsJson = [NSString stringWithUTF8String:error_json_p]; + + NSError *error; + NSDictionary *errorDetails = [NSJSONSerialization JSONObjectWithData:[NSData dataWithBytes:[errorDetailsJson UTF8String] + length:[errorDetailsJson length]] + options:kNilOptions + error: &error]; + + [userInfo setValue:errorDetails[@"error"] forKey:@"sdk_message"]; + [userInfo setValue:errorDetails[@"message"] forKey:@"sdk_full_message"]; + [userInfo setValue:errorDetails[@"cause"] forKey:@"sdk_cause"]; + [userInfo setValue:errorDetails[@"backtrace"] forKey:@"sdk_backtrace"]; + } return [NSError errorWithDomain:VcxErrorDomain code: error userInfo:userInfo]; } diff --git a/vcx/wrappers/ios/vcx/vcx.framework/Headers/libvcx.h b/vcx/wrappers/ios/vcx/vcx.framework/Headers/libvcx.h index c4c44abc77..9774400399 100644 --- a/vcx/wrappers/ios/vcx/vcx.framework/Headers/libvcx.h +++ b/vcx/wrappers/ios/vcx/vcx.framework/Headers/libvcx.h @@ -68,7 +68,7 @@ vcx_error_t vcx_update_agent_info(vcx_command_handle_t handle, const char *info, const char *vcx_error_c_message(int); const char *vcx_version(); -vcx_error_t vcx_current_error(const char ** error_json_p); +vcx_error_t vcx_get_current_error(const char ** error_json_p); /** * Schema object