//
//  APMBridgeUtils.m
//  RCTAPMBanner
//
//  Created by Vincent Ducastel on 22/08/2017.
//  Copyright © 2017 remobile. All rights reserved.
//

#import "APMBridgeUtils.h"
#import "APMConstants.h"

@implementation APMBridgeUtils

+(NSError*)errorFromException:(NSException*)exception
{
    NSString* desc = [NSString stringWithFormat:@"[%@]", exception.name];
    if(exception.reason)
    {
        desc = [desc stringByAppendingString:@" "];
        desc = [desc stringByAppendingString:exception.reason];
    }
    NSLog(@"Exception : %@", desc);
    NSDictionary *errorInfo = @{NSLocalizedDescriptionKey:desc};
    NSError* error = [NSError errorWithDomain:@"" code:APM_BRIDGE_ERROR_UNKNOWN userInfo:errorInfo];
    return error;
}

@end
