コード例 #1
0
ファイル: errors.go プロジェクト: kkroening/repeatr
var ExitCodeKey = errors.GenSym()

/*
	CLI errors are the last line: they should be formatted to be user-facing.
	The main method will convert a CLIError into a short and well-formatted
	message, and will *not* include stack traces unless the user is running
	with debug mode enabled.

	CLI errors are an appropriate wrapping for anything where we can map a
	problem onto something the user can understand and fix.  Errors that are
	a repeatr bug or unknown territory should *not* be mapped into a CLIError.
*/
var Error *errors.ErrorClass = errors.NewClass("CLIError")

/*
	Use this to set a specific error code the process should exit with
	when producing a `cli.Error`.

	Example: `cli.Error.NewWith("something terrible!", SetExitCode(EXIT_BADARGS))`
*/
func SetExitCode(code ExitCode) errors.ErrorOption {
	return errors.SetData(ExitCodeKey, code)
}

/*
	Exit errors may be raised to immediately transition to we're done (and
	specify an `ExitCode`), but generate slightly less of a sadface than
	`cli.Error`: use them for graceful exits.
*/
var Exit *errors.ErrorClass = Error.NewClass("Exit")
コード例 #2
0
ファイル: errors.go プロジェクト: kkroening/repeatr
package scheduler

import (
	"github.com/spacemonkeygo/errors"
)

// grouping, do not instantiate
var Error *errors.ErrorClass = errors.NewClass("SchedulerError")

// error when a scheduler's queue was full and could not enqueue a forumla.
var QueueFullError *errors.ErrorClass = Error.NewClass("QueueFullError")
コード例 #3
0
ファイル: bucket.go プロジェクト: kkroening/repeatr
type RecordIterator interface {
	treewalk.Node
	Record() Record
}

var InvalidFilesystem *errors.ErrorClass = errors.NewClass("InvalidFilesystem")

/*
	PathCollision is reported when the same file path is submitted to a `Bucket`
	more than once.  (Some formats, for example tarballs, allow the same filename
	to be recorded twice.  We consider this poor behavior since most actual
	filesystems of course will not tolerate this, and also because it begs the
	question of which should be sorted first when creating a deterministic
	hash of the whole tree.)
*/
var PathCollision *errors.ErrorClass = InvalidFilesystem.NewClass("PathCollision")

/*
	MissingTree is reported when iteration over a filled bucket encounters
	a file that has no parent nodes.  I.e., if there's a file path "./a/b",
	and there's no entries for "./a", it's a MissingTree error.
*/
var MissingTree *errors.ErrorClass = InvalidFilesystem.NewClass("MissingTree")

/*
	Major error raised when (redundant) checks on input validation fail.
	(Like all subtypes of `ProgrammerError`, it's not necessary for consumers
	to check for these; in theory all checks that raise this kind of error
	could be disabled in except in debug builds.)
*/
var InvalidParameter *errors.ErrorClass = errors.ProgrammerError.NewClass("InvalidParameter")
コード例 #4
0
ファイル: errors.go プロジェクト: kkroening/repeatr
package executor

import (
	"github.com/spacemonkeygo/errors"
)

// grouping, do not instantiate
var Error *errors.ErrorClass = errors.NewClass("ExecutorError")

/*
	Error raised when an executor cannot operate due to invalid setup.
*/
var ConfigError *errors.ErrorClass = Error.NewClass("ExecutorConfigError")

/*
	Error raised when there are serious issues with task launch.

	Occurance of TaskExecError may be due to OS-imposed resource limits
	or other unexpected problems.  They should not be seen in normal,
	healthy operation.
*/
var TaskExecError *errors.ErrorClass = Error.NewClass("ExecutorTaskExecError")

/*
	Error raised when a command is not found inside the execution environment.

	Often just indicative of user misconfiguration (and thus this is not a
	child of TaskExecError, which expresses serious system failures).
*/
var NoSuchCommandError *errors.ErrorClass = Error.NewClass("NoSuchCommandError")
コード例 #5
0
ファイル: errors.go プロジェクト: kkroening/repeatr
	(They're not all grouped under TransmatError because they're not all
	the transmat's fault, per se; fixing them requires looking afield.)

	Additionally, these other systems may fail, but are rare, internal, and serious:
		- Error
		  - PlacerError
		  // actually that's it... assemblers, to date, don't represent enough
		  //  code to have their own interesting failure modes.

*/
var Error *errors.ErrorClass = errors.NewClass("IntegrityError") // grouping, do not instantiate // n.b. the ambiguity and alarmingness of this error name is the clearest example of why this package needs rethinking on the name.

/*
	Raised to indicate that some configuration is missing or malformed.
*/
var ConfigError *errors.ErrorClass = Error.NewClass("ConfigError")

/*
	Raised to indicate a serious internal error with a transmat's functioning.

	Typically these indicate a need for the whole program to stop; examples are
	the repeatr daemon hitting permissions problems in the main work area,
	or running out of disk space, or something equally severe.

	Errors relating to the either the warehouse, the data integrity checks,
	or the operational theater on the local filesystem are all different
	categories of error.
*/
var TransmatError *errors.ErrorClass = Error.NewClass("TransmatError")

/*
コード例 #6
0
ファイル: errors.go プロジェクト: kkroening/repeatr
package fs

import (
	"github.com/spacemonkeygo/errors"
)

var Error *errors.ErrorClass = errors.NewClass("FSError") // grouping, do not instantiate

/*
	`BreakoutError` is raised when processing a filesystem description where links
	(symlinks, hardlinks) are constructed in such a way that they would reach
	out of the base directory.  Encountering these in a well-formed filesystem
	description is basically an attempted attack.
*/
var BreakoutError *errors.ErrorClass = Error.NewClass("FSBreakoutError")

func ioError(err error) {
	panic(Error.Wrap(errors.IOError.Wrap(err)))
}