Skip to content

Commit d5b045e

Browse files
committed
fix(edulint): ignore all errors
1 parent 36a1b3e commit d5b045e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/app/services/root/h-t-t-p-error-handler.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Router } from '@angular/router';
44
import { Observable, throwError } from 'rxjs';
55
import { catchError } from 'rxjs/operators';
66
import { ModalService } from '../shared';
7+
import { environment } from "../../../environments/environment";
78

89
@Injectable({
910
providedIn: 'root'
@@ -18,7 +19,8 @@ export class HTTPErrorHandlerService implements HttpInterceptor {
1819
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
1920
return next.handle(req).pipe(
2021
catchError((error) => {
21-
if (error instanceof HttpErrorResponse) {
22+
// ignore EduLint-related errors
23+
if (error instanceof HttpErrorResponse && !req.url.startsWith(environment.edulint.url)) {
2224
const position = {
2325
path: location.pathname,
2426
};

src/app/services/tasks/edulint.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
33
import { APIService, Configuration, WebService } from '../../../api/edulint';
44
import { environment } from '../../../environments/environment';
55
import { combineLatest, Observable, of } from 'rxjs';
6-
import { filter, map, mergeMap } from 'rxjs/operators';
6+
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
77
import { EdulintReport } from '../../models';
88

99
@Injectable({
@@ -18,9 +18,7 @@ export class EdulintService {
1818

1919
constructor(private httpClient: HttpClient) {
2020
const config = environment.edulint;
21-
if (config === undefined) {
22-
throw new Error('EduLint environment is undefined');
23-
}
21+
2422
this.version = config.version;
2523
this.url = config.url;
2624
this.config = config.config;
@@ -33,6 +31,10 @@ export class EdulintService {
3331
code += `\n# edulint: config=${this.config}\n`;
3432

3533
return this.linter.apiCodePost({code}).pipe(
34+
catchError((e) => {
35+
environment.logger.error('[EduLint] Code post error', e);
36+
return of({hash: undefined});
37+
}),
3638
filter((response) => response.hash !== undefined),
3739
map(response => `${response.hash}`),
3840
mergeMap((hash) => combineLatest([this.linter.analyzeUploaded(this.version, hash), of(hash)])),

0 commit comments

Comments
 (0)