Skip to content
Snippets Groups Projects
Commit db854edc authored by mechtelm's avatar mechtelm
Browse files

xml upload error reported properly again #128

parent fa629336
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
<button mat-raised-button type="submit" [disabled]="loginForm.invalid" color="primary">Weiter</button>
</mat-card-actions>
</form>
<p style="color: chocolate"><b>{{ problemText }}</b></p>
<p style="color: chocolate" *ngIf="!mds.isApiValid"><b>Die Verbindung mit dem Server ist nicht möglich.</b></p>
</mat-card>
......
import {Component, EventEmitter, Input, OnInit, Output, HostBinding, OnDestroy} from '@angular/core';
import { HttpClient, HttpEventType, HttpHeaders, HttpParams,
HttpEvent } from '@angular/common/http';
import {
HttpClient, HttpEventType, HttpHeaders, HttpParams,
HttpEvent, HttpErrorResponse
} from '@angular/common/http';
import {ApiError} from "../../../../app.interfaces";
@Component({
......@@ -153,12 +156,24 @@ import { HttpClient, HttpEventType, HttpHeaders, HttpParams,
this.remove();
}
}
}, () => {
}, (err) => {
if (this.fileUploadSubscription) {
this.fileUploadSubscription.unsubscribe();
}
this.status = UploadStatus.error;
if (err instanceof HttpErrorResponse) {
this.requestResponseText = (err as HttpErrorResponse).message;
} else if (err instanceof ApiError) {
const apiError: ApiError = err;
if (apiError.code === 422) {
const slashPos = apiError.info.indexOf(' // ');
this.requestResponseText = (slashPos > 0) ? apiError.info.substr(slashPos + 4) : apiError.info;
} else {
this.requestResponseText = apiError.info;
}
} else {
this.requestResponseText = 'Hochladen nicht erfolgreich.'
}
});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment