[mod] e-mails plus explicites (titre + motif erreur)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user