Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {throwError} from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { throwError } from 'rxjs';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ErrorLoggerService {
|
||||
constructor() {
|
||||
public static log(serviceName = 'error-logger', message: string) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`${serviceName}Service: ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15,22 +17,11 @@ export class ErrorLoggerService {
|
||||
* @param operation - name of the operation that failed
|
||||
* @param result - optional value to return as the observable result
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
||||
public handleError<T>(serviceName = 'error-logger', operation = 'operation', result?: T) {
|
||||
return (error: any): Observable<T> => {
|
||||
|
||||
// TODO: send the error to remote logging infrastructure
|
||||
console.error(error); // log to console instead
|
||||
|
||||
// TODO: better job of transforming error for user consumption
|
||||
this.log(serviceName, `${operation} failed: ${error.message}`);
|
||||
|
||||
// // Let the app keep running by returning an empty result.
|
||||
// return of(result as T);
|
||||
ErrorLoggerService.log(serviceName, `${operation} failed: ${error}`);
|
||||
return throwError(error);
|
||||
};
|
||||
}
|
||||
|
||||
public log(serviceName = 'error-logger', message: string) {
|
||||
console.log(serviceName + 'Service: ' + message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user