@@ -755,14 +755,14 @@ Mana.prototype.send = function send(args) {
755
755
756
756
if (
757
757
! ( res . statusCode >= 200 && res . statusCode < 300 )
758
- && 404 !== res . statusCode
758
+ && 404 !== res . statusCode && 409 !== res . statusCode
759
759
) {
760
760
761
761
//
762
762
// Assume that the server is returning an unknown response and that we
763
763
// should try a different server.
764
764
//
765
- mana . debug ( 'Received an invalid statusCode (%s) for URL %s' , res . statusCode , options . uri ) ;
765
+ mana . debug ( 'Received an invalid statusCode (%s) for URL %s %s ' , res . statusCode , options . uri , body ) ;
766
766
err = new Error ( 'Received a non 200 status code: ' + res . statusCode ) ;
767
767
768
768
err . url = options . uri ; // The URL we accessed.
@@ -819,17 +819,18 @@ Mana.prototype.send = function send(args) {
819
819
// write it to our Assign instance it could cause issues as the data
820
820
// format might differ. So instead we're going to call this as an error.
821
821
//
822
- if ( res . statusCode === 404 && 'HEAD' !== options . method ) {
823
- err = new Error ( 'Invalid status code: 404' ) ;
824
-
825
- err . url = options . uri ; // URL of the request.
826
- err . statusCode = 404 ; // Status code.
827
- err . errors = errors ; // Previous errors.
828
- err . body = body ; // The response body.
829
- err . data = data ; // Parsed response.
830
- err . remaining = mana . remaining ; // Rate remaining.
831
- err . ratereset = mana . ratereset ; // Rate reset.
832
- err . ratelimit = mana . ratelimit ; // Rate limit.
822
+ if ( ( res . statusCode === 404 || res . statusCode === 409 )
823
+ && 'HEAD' !== options . method ) {
824
+ err = new Error ( 'Invalid status code: ' + res . statusCode ) ;
825
+
826
+ err . url = options . uri ; // URL of the request.
827
+ err . statusCode = res . statusCode ; // Status code.
828
+ err . errors = errors ; // Previous errors.
829
+ err . body = body ; // The response body.
830
+ err . data = data ; // Parsed response.
831
+ err . remaining = mana . remaining ; // Rate remaining.
832
+ err . ratereset = mana . ratereset ; // Rate reset.
833
+ err . ratelimit = mana . ratelimit ; // Rate limit.
833
834
834
835
return assign . destroy ( err ) ;
835
836
}
0 commit comments