generalov/angular-http-mock

View on GitHub
src/angular-http-mock/src/http-mock-error.ts

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * Created by Evgeniy_Generalov on 9/30/2016.
 */

import {MockConnection} from '@angular/http/testing';
import {Response} from '@angular/http';


export class HttpMockError extends Error {
  /** @type {MockConnection} The MockConnection instance associated with the error */
  xhr: MockConnection;
  /** @type {number} The HTTP status code */
  status: number;

  constructor(message: string, xhr: MockConnection, response: Response) {
    super(message);
    this.message = message;
    this.status = response.status;
    this.xhr = xhr;
  }
}