Skip to content

Commit

Permalink
use keys we store in destination attribute db and remove loggers (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPant1999 authored Jun 16, 2023
1 parent 14ed4b8 commit 43eeb1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
12 changes: 4 additions & 8 deletions netsuitesdk/errors/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,24 @@ def get_entity_values(self, error_dict):

if object_1 and object_2:
if entity_keys[0] == 'customer' and entity_keys[1] == 'employee':
object_1 = object_1['entityId']
object_2 = object_2['email'] if object_2['email'] else object_2['firstName'] + " " + object_2['lastName']
return object_1, object_2
return object_1['entityId'], object_2['entityId']

if entity_keys[1] == 'employee':
object_2 = object_2['email'] if object_2['email'] else object_2['firstName'] + " " + object_2['lastName']
return object_1['name'], object_2
return object_1['name'], object_2['entityId']

if entity_keys[0] == 'account':
object_1 = object_1['acctName']
return object_1, object_2['name']

if entity_keys[0] == 'vendor':
object_1 = object_1['companyName'] if object_1['companyName'] else object_1['entityId']
return object_1, object_2['name']
return object_1['entityId'], object_2['name']

return object_1['name'], object_2['name']


def export_error_parser(self, error_dict, message):

parsed_message = message
print('dsdf', list(error_dict))
if list(error_dict) in list_of_dicts:
object_1, object_2 = self.get_entity_values(error_dict)
entity_keys = list(error_dict)
Expand Down
11 changes: 7 additions & 4 deletions netsuitesdk/internal/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,13 @@ def upsert(self, record, record_type=None):
exc = self._request_error('upsert', detail=status['statusDetail'][0])

if record_type:
error_parser = ErrorParser(self.get)
error_dict = export_error_matcher(exc.message, record_type)
message = error_parser.export_error_parser(error_dict, exc.message)
exc.message = message
try:
error_parser = ErrorParser(self.get)
error_dict = export_error_matcher(exc.message, record_type)
message = error_parser.export_error_parser(error_dict, exc.message)
exc.message = message
except Exception as e:
self.logger.debug('Error parsing error message', e.message)

raise exc

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='netsuitesdk',
version='2.19.1',
version='2.19.2',
author='Siva Narayanan',
author_email='[email protected]',
description='Python SDK for accessing the NetSuite SOAP webservice',
Expand Down

0 comments on commit 43eeb1e

Please sign in to comment.