Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Injectable } from '@angular/core';
import { throwError } from 'rxjs';
import { catchError, retry } from 'rxjs/operators';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class OrdersService {
private numRetry = 1;
constructor(public http: HttpClient) {
}
// from the angular docs...
private handleError(error: HttpErrorResponse) {
let retVal = '';
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error('An error occurred:', error.error.message);
retVal = 'A network error occurred, check your device\'s connectivity.';
} else {
console.error('Error calling EHR at ' + error.url + ' - response was a ' + error.status);
retVal = 'An error occurred connecting to the EHR system. Could not retrieve information (' + error.status + ')';
}
// return an ErrorObservable with a user-facing error message
return throwError(retVal);
}
}