Skip to content

Commit

Permalink
Merge branch 'master' into WalletHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
jovfer authored Mar 14, 2019
2 parents 7ca5f68 + db599d1 commit f37e0a5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
36 changes: 19 additions & 17 deletions vcx/wrappers/ios/vcx/utils/NSError+VcxError.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//

#import "NSError+VcxError.h"
#import "vcx.h"
#include "vcx.h"

static NSString *const VcxErrorDomain = @"VcxErrorDomain";

Expand All @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion vcx/wrappers/ios/vcx/vcx.framework/Headers/libvcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f37e0a5

Please sign in to comment.