balmbees / dynamo-types

Typescript AWS DynamoDB ORM
231 stars 18 forks source link

fix error message couldn't show up correctly #13

Closed mooyoul closed 6 years ago

mooyoul commented 6 years ago

at this moment, dynamo-types can't show error message correctly.

expected error message or stack trace is like below:

2018-01-06 7 08 15

but actual error message that we got:

2018-01-06 7 04 50

when table tries to log table instance if something went wrong during writing item, we call JSON.stringify to get JSON.

In theory, JSON.stringify traverses entire object (think tree structure), so if any leaf node has circular reference, process cannot to be ended. and that's why JSON.stringify throws circular reference error.

anyway we can prevent this error by logging attributes only, so i've applied that workaround

breath103 commented 6 years ago

well would be nicer if we can kinda start working on using proper logger. it's lame to use console.log on production code in year 2018 but that's another story. as of this change it seems good