@@ -53,6 +53,8 @@ module.exports = function (common, deps) {
5353 . put ( common . makeAPIUrl ( '/confirm/accept/signup/' + signupId ) )
5454 . end ( function ( err , res ) {
5555 if ( err != null ) {
56+ // TODO: update version of lodash so we can use _.get
57+ err . message = ( err . response && err . response . body && err . response . body . reason ) || '' ;
5658 return cb ( err ) ;
5759 }
5860 if ( res . status !== 200 ) {
@@ -77,6 +79,8 @@ module.exports = function (common, deps) {
7779 . send ( { birthday : birthday , password : password } )
7880 . end ( function ( err , res ) {
7981 if ( err != null ) {
82+ err . error = ( err . response && err . response . body && err . response . body . error ) || '' ;
83+ err . message = ( err . response && err . response . body && err . response . body . reason ) || '' ;
8084 return cb ( err ) ;
8185 }
8286 if ( res . status !== 200 ) {
@@ -98,6 +102,7 @@ module.exports = function (common, deps) {
98102 . post ( common . makeAPIUrl ( '/confirm/resend/signup/' + email ) )
99103 . end ( function ( err , res ) {
100104 if ( err != null ) {
105+ err . message = ( err . response && err . response . error ) || '' ;
101106 return cb ( err ) ;
102107 }
103108 if ( res . status !== 200 ) {
@@ -154,7 +159,10 @@ module.exports = function (common, deps) {
154159 . end (
155160 function ( err , res ) {
156161 if ( err != null ) {
157- return cb ( err ) ;
162+ if ( err . status === 404 ) {
163+ return cb ( null , [ ] ) ;
164+ }
165+ return cb ( ( err . response && err . response . body ) || [ ] ) ;
158166 }
159167 if ( res . status === 200 ) {
160168 return cb ( null , res . body ) ;
@@ -253,6 +261,7 @@ module.exports = function (common, deps) {
253261 . post ( common . makeAPIUrl ( '/confirm/send/forgot/' + email ) )
254262 . end ( function ( err , res ) {
255263 if ( err != null ) {
264+ err . message = ( err . response && err . response . error ) || '' ;
256265 return cb ( err ) ;
257266 }
258267 if ( res . status !== 200 ) {
@@ -280,6 +289,7 @@ module.exports = function (common, deps) {
280289 . send ( payload )
281290 . end ( function ( err , res ) {
282291 if ( err != null ) {
292+ err . message = ( err . response && err . response . error ) || '' ;
283293 return cb ( err ) ;
284294 }
285295 if ( res . status !== 200 ) {
0 commit comments