mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 08:25:36 +00:00
parent
f6692ab918
commit
445aefaa29
@ -17,6 +17,7 @@ import {
|
||||
ContractValidationError,
|
||||
ContractViolationError,
|
||||
InternalInconsistencyError,
|
||||
TargetStateError,
|
||||
} from './lib/errors';
|
||||
import * as request from './lib/request';
|
||||
|
||||
@ -186,7 +187,8 @@ export async function start() {
|
||||
function handleTargetUpdateError(err: any) {
|
||||
if (
|
||||
err instanceof ContractValidationError ||
|
||||
err instanceof ContractViolationError
|
||||
err instanceof ContractViolationError ||
|
||||
err instanceof TargetStateError
|
||||
) {
|
||||
log.error(`Could not store target state for device: ${err}`);
|
||||
// the dashboard does not display lines correctly,
|
||||
|
@ -22,7 +22,11 @@ import * as globalEventBus from './event-bus';
|
||||
import * as hostConfig from './host-config';
|
||||
import constants = require('./lib/constants');
|
||||
import * as dbus from './lib/dbus';
|
||||
import { InternalInconsistencyError, UpdatesLockedError } from './lib/errors';
|
||||
import {
|
||||
InternalInconsistencyError,
|
||||
TargetStateError,
|
||||
UpdatesLockedError,
|
||||
} from './lib/errors';
|
||||
import * as updateLock from './lib/update-lock';
|
||||
import * as validation from './lib/validation';
|
||||
import * as network from './network';
|
||||
@ -52,7 +56,7 @@ function parseTargetState(state: unknown): TargetState {
|
||||
}
|
||||
|
||||
const errors = ['Invalid target state.'].concat(Reporter.report(res));
|
||||
throw new Error(errors.join('\n'));
|
||||
throw new TargetStateError(errors.join('\n'));
|
||||
}
|
||||
|
||||
// TODO (refactor): This shouldn't be here, and instead should be part of the other
|
||||
|
@ -81,6 +81,8 @@ export class ConfigurationValidationError extends TypedError {
|
||||
|
||||
export class ImageAuthenticationError extends TypedError {}
|
||||
|
||||
export class TargetStateError extends TypedError {}
|
||||
|
||||
/**
|
||||
* An error thrown if our own container cannot be inspected.
|
||||
* See LocalModeManager for a usage example.
|
||||
|
Loading…
x
Reference in New Issue
Block a user