| 589 | | if ( response && response.message ) { |
| 590 | | if ( ( response.type === 'not-embeddable' && self.type === 'embed' ) || |
| 591 | | response.type === 'not-ssl' ) { |
| 592 | | |
| 593 | | self.setError( response.message, 'admin-media' ); |
| 594 | | } else { |
| 595 | | self.setContent( '<p>' + self.original + '</p>', 'replace' ); |
| 596 | | } |
| 597 | | } else if ( response && response.statusText ) { |
| 598 | | self.setError( response.statusText, 'admin-media' ); |
| 599 | | } |
| | 588 | self.fail( response || true ); |
| | 589 | } ) |
| | 590 | .always( function() { |
| | 591 | self.fail( ! self.parsed ); |
| | 595 | fail: function( error ) { |
| | 596 | if ( ! this.error ) { |
| | 597 | if ( error ) { |
| | 598 | this.error = error |
| | 599 | } else { |
| | 600 | return; |
| | 601 | } |
| | 602 | } |
| | 603 | |
| | 604 | if ( this.error.message ) { |
| | 605 | if ( ( this.error.type === 'not-embeddable' && this.type === 'embed' ) || this.error.type === 'not-ssl' ) { |
| | 606 | this.setError( this.error.message, 'admin-media' ); |
| | 607 | } else { |
| | 608 | this.setContent( '<p>' + this.original + '</p>', 'replace' ); |
| | 609 | } |
| | 610 | } else if ( this.error.statusText ) { |
| | 611 | this.setError( this.error.statusText, 'admin-media' ); |
| | 612 | } else if ( this.original ) { |
| | 613 | this.setContent( '<p>' + this.original + '</p>', 'replace' ); |
| | 614 | } |
| | 615 | }, |
| | 616 | |