Extending error information

This commit is contained in:
piotrpekala7 2020-03-17 17:45:01 +01:00
parent ae540777a4
commit 2b45f7a643
2 changed files with 13 additions and 4 deletions

View File

@ -20,8 +20,8 @@ export class ProgressService {
constructor() {}
public setError(error: Error) {
this.state.next(new State(false, error));
public setError(error) {
this.state.next(new State(false, error.error));
}
public clear() {

View File

@ -2,6 +2,7 @@ import { Component, Input, OnInit, OnChanges } from '@angular/core';
import { Server } from '../../../../../models/server';
import { NodeService } from '../../../../../services/node.service';
import { Node } from '../../../../../cartography/models/node';
import { ToasterService } from '../../../../../services/toaster.service';
@Component({
selector: 'app-start-node-action',
@ -12,7 +13,10 @@ export class StartNodeActionComponent implements OnInit, OnChanges {
@Input() nodes: Node[];
isNodeWithStoppedStatus: boolean;
constructor(private nodeService: NodeService) {}
constructor(
private nodeService: NodeService,
private toasterService: ToasterService
) {}
ngOnInit() {
}
@ -30,7 +34,12 @@ export class StartNodeActionComponent implements OnInit, OnChanges {
startNodes() {
this.nodes.forEach((node) => {
this.nodeService.start(this.server, node).subscribe((n: Node) => {});
this.nodeService.start(this.server, node).subscribe(
(n: Node) => {},
error => {
this.toasterService.error(error.error.message)
}
);
});
}
}