{"action":"closed","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/639","labels_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/639/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/639/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/639/events","html_url":"https://github.com/aws/aws-sdk-js/issues/639","id":90787811,"number":639,"title":"Error stacks thrown in callback lose the stack context","user":{"login":"mdouglass","id":5410142,"avatar_url":"https://avatars.githubusercontent.com/u/5410142?v=3","gravatar_id":"","url":"https://api.github.com/users/mdouglass","html_url":"https://github.com/mdouglass","followers_url":"https://api.github.com/users/mdouglass/followers","following_url":"https://api.github.com/users/mdouglass/following{/other_user}","gists_url":"https://api.github.com/users/mdouglass/gists{/gist_id}","starred_url":"https://api.github.com/users/mdouglass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdouglass/subscriptions","organizations_url":"https://api.github.com/users/mdouglass/orgs","repos_url":"https://api.github.com/users/mdouglass/repos","events_url":"https://api.github.com/users/mdouglass/events{/privacy}","received_events_url":"https://api.github.com/users/mdouglass/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-24T21:52:12Z","updated_at":"2015-07-01T22:22:52Z","closed_at":"2015-07-01T22:22:52Z","body":"If you throw an error inside a callback from one of the DynamoDB APIs the original call stack and error type of the error is lost.\r\n\r\n```javascript\r\nvar AWS = require('aws-sdk');\r\nAWS.config.region = 'us-east-1';\r\nvar ddb = new AWS.DynamoDB();\r\nddb.listTables(function(err, data) {\r\n  foo.bar(); \r\n});\r\n```\r\n\r\n**Actual Error:**\r\n```\r\nError: foo is not defined\r\n    at Request.callListeners (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/sequential_executor.js:107:43)\r\n    at Request.emit (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\r\n    at Request.emit (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/request.js:595:14)\r\n    at Request.transition (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/request.js:21:10)\r\n    at AcceptorStateMachine.runTo (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/state_machine.js:14:12)\r\n    at /Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/state_machine.js:26:10\r\n    at Request.<anonymous> (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/request.js:37:9)\r\n    at Request.<anonymous> (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/request.js:597:12)\r\n    at Request.callListeners (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/sequential_executor.js:115:18)\r\n    at Request.emit (/Users/mdouglass/kixeye/km/server/kmservices/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\r\n```\r\n**Expected:**\r\nReferenceError pointing to the line of code in my callback function, rather than to Request.callListeners"}}