1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
// Tideland Go Library - Loop - Errors
//
// Copyright (C) 2013-2017 Frank Mueller / Tideland / Oldenburg / Germany
//
// All rights reserved. Use of this source code is governed
// by the new BSD license.
package loop
//--------------------
// IMPORTS
//--------------------
import (
"github.com/tideland/golib/errors"
)
//--------------------
// CONSTANTS
//--------------------
// Error codes of the loop package.
const (
ErrLoopPanicked = iota + 1
ErrHandlingFailed
ErrRestartNonStopped
ErrKilledBySentinel
)
var errorMessages = errors.Messages{
ErrLoopPanicked: "loop panicked: %v",
ErrHandlingFailed: "error handling for %q failed",
ErrRestartNonStopped: "cannot restart unstopped %q",
ErrKilledBySentinel: "%q killed by sentinel",
}
//--------------------
// TESTING
//--------------------
// IsKilledBySentinelError allows to check, if a loop or
// sentinel has been stopped due to internal reasons or
// after the error of another loop or sentinel.
func IsKilledBySentinelError(err error) bool {
return errors.IsError(err, ErrKilledBySentinel)
}
// EOF
|