{"action":"closed","issue":{"url":"https://api.github.com/repos/Mangopay/mangopay2-nodejs-sdk/issues/45","repository_url":"https://api.github.com/repos/Mangopay/mangopay2-nodejs-sdk","labels_url":"https://api.github.com/repos/Mangopay/mangopay2-nodejs-sdk/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/Mangopay/mangopay2-nodejs-sdk/issues/45/comments","events_url":"https://api.github.com/repos/Mangopay/mangopay2-nodejs-sdk/issues/45/events","html_url":"https://github.com/Mangopay/mangopay2-nodejs-sdk/issues/45","id":199678285,"number":45,"title":"Error not caught using promises","user":{"login":"yns01","id":6934597,"avatar_url":"https://avatars.githubusercontent.com/u/6934597?v=3","gravatar_id":"","url":"https://api.github.com/users/yns01","html_url":"https://github.com/yns01","followers_url":"https://api.github.com/users/yns01/followers","following_url":"https://api.github.com/users/yns01/following{/other_user}","gists_url":"https://api.github.com/users/yns01/gists{/gist_id}","starred_url":"https://api.github.com/users/yns01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yns01/subscriptions","organizations_url":"https://api.github.com/users/yns01/orgs","repos_url":"https://api.github.com/users/yns01/repos","events_url":"https://api.github.com/users/yns01/events{/privacy}","received_events_url":"https://api.github.com/users/yns01/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-01-09T22:20:27Z","updated_at":"2017-01-16T09:04:02Z","closed_at":"2017-01-16T09:04:02Z","body":"Hello,\r\n\r\nUsing  `\"mangopay2-nodejs-sdk\": \"^1.3.2\"`, it seems that when using promises errors are not caught in the catch block:\r\n\r\n  ```\r\n  mangoPayApi.CardRegistrations.create({\r\n      \"UserId\": '12345678',\r\n      \"Currency\": \"EUR\",\r\n      \"CardType\": \"CB_VISA_MASTERCARD\"\r\n    }).then((aCardRegistration) => {\r\n      console.log('Promise OK');\r\n      // console.log(aCardRegistration);\r\n    }).catch((e) => {\r\n      console.log('Promise failed');\r\n      console.log(e);\r\n    });\r\n```\r\nSince the UserId does not exists, the promise will fail. However, the output is:\r\n\r\n```\r\nW20170109-23:03:21.534(1)? (STDERR) The ressource does not exist { Message: 'The ressource does not exist',\r\nW20170109-23:03:21.535(1)? (STDERR)   Type: 'ressource_not_found',\r\nW20170109-23:03:21.535(1)? (STDERR)   Id: 'a04adf4a-6569-44ad-aafd-1f6e23424ca7#1483999401',\r\nW20170109-23:03:21.535(1)? (STDERR)   Date: 1483999402,\r\nW20170109-23:03:21.536(1)? (STDERR)   errors: { RessourceNotFound: 'Cannot found the ressource User with the id=12345678 ' } }\r\n*20170109-23:03:21.538(1)? Promise OK <===\r\nI20170109-23:03:21.538(1)? { Message: 'The ressource does not exist',\r\nI20170109-23:03:21.539(1)?   Type: 'ressource_not_found',\r\nI20170109-23:03:21.540(1)?   Id: 'a04adf4a-6569-44ad-aafd-1f6e23424ca7#1483999401',\r\nI20170109-23:03:21.541(1)?   Date: 1483999402,\r\nI20170109-23:03:21.543(1)?   errors: { RessourceNotFound: 'Cannot found the ressource User with the id=12345678 ' } }\r\n```\r\n\r\nIt looks like that, not only the catch part is not executed, but the then part is despite the error... Not sure if I am doing something wrong or there's an issue.\r\n\r\nThanks for your support.\r\n"}}
{"actor":{"display_login":"hobailey"}}