@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
3
3
import { APIService , Configuration , WebService } from '../../../api/edulint' ;
4
4
import { environment } from '../../../environments/environment' ;
5
5
import { combineLatest , Observable , of } from 'rxjs' ;
6
- import { filter , map , mergeMap } from 'rxjs/operators' ;
6
+ import { catchError , filter , map , mergeMap } from 'rxjs/operators' ;
7
7
import { EdulintReport } from '../../models' ;
8
8
9
9
@Injectable ( {
@@ -18,9 +18,7 @@ export class EdulintService {
18
18
19
19
constructor ( private httpClient : HttpClient ) {
20
20
const config = environment . edulint ;
21
- if ( config === undefined ) {
22
- throw new Error ( 'EduLint environment is undefined' ) ;
23
- }
21
+
24
22
this . version = config . version ;
25
23
this . url = config . url ;
26
24
this . config = config . config ;
@@ -33,6 +31,10 @@ export class EdulintService {
33
31
code += `\n# edulint: config=${ this . config } \n` ;
34
32
35
33
return this . linter . apiCodePost ( { code} ) . pipe (
34
+ catchError ( ( e ) => {
35
+ environment . logger . error ( '[EduLint] Code post error' , e ) ;
36
+ return of ( { hash : undefined } ) ;
37
+ } ) ,
36
38
filter ( ( response ) => response . hash !== undefined ) ,
37
39
map ( response => `${ response . hash } ` ) ,
38
40
mergeMap ( ( hash ) => combineLatest ( [ this . linter . analyzeUploaded ( this . version , hash ) , of ( hash ) ] ) ) ,
0 commit comments