[mod] e-mails plus explicites (titre + motif erreur)

This commit is contained in:
2020-05-08 11:03:00 +02:00
parent 2be3471067
commit f3b50c4fea
10 changed files with 110 additions and 69 deletions

View File

@@ -1,21 +1,32 @@
export class Watcher {
private state: 'INIT'|'OK'|'FAILURE'|'RECOVERED'
private failureMessage?: string
private _state: 'INIT'|'OK'|'FAILURE'|'RECOVERED'
private _error?: any
constructor(public readonly name: string) {
this.state = "INIT"
this._state = "INIT"
}
public stateOK() {
this.state = "OK"
this._state = "OK"
}
public stateRecovered() {
this.state = "RECOVERED"
this._state = "RECOVERED"
}
public stateFailure(error: string) {
this.state = "FAILURE"
this.failureMessage = error
public stateFailure(error: any) {
this._state = "FAILURE"
this._error = error
}
public get error() {
return this._error
}
public get failureMessage(): string|undefined {
if (!this._error) {
return undefined
}
return this._error.message || this._error
}
}