Beispiel #1
0
	std_errors "errors"
	"fmt"
	math_rand "math/rand"
	"strings"
	"sync"
	"time"

	"github.com/spacemonkeygo/errors"
	"github.com/spacemonkeygo/spacelog"

	"sm/final/grid"
	"sm/final/renderer"
)

var (
	GameError = errors.NewClass("game error", errors.NoCaptureStack())
	JoinError = GameError.NewClass("join error")

	logger = spacelog.GetLogger()
)

type Command string

const (
	selfDestruct Command = "kaboom"
	Join         Command = "join"
	Noop         Command = "noop"
	MoveForward  Command = "move"
	RotateLeft   Command = "left"
	RotateRight  Command = "right"
	FireLaser    Command = "fire"
Beispiel #2
0
// Copyright (C) 2016 JT Olds
// See LICENSE for copying information

package webhelp

import (
	"net/http"

	"github.com/spacemonkeygo/errors"
	"github.com/spacemonkeygo/errors/errhttp"
)

var (
	HTTPError     = errors.NewClass("HTTP Error", errors.NoCaptureStack())
	ErrBadRequest = HTTPError.NewClass("Bad request",
		errhttp.SetStatusCode(http.StatusBadRequest))
	ErrNotFound = ErrBadRequest.NewClass("Not found",
		errhttp.SetStatusCode(http.StatusNotFound))
	ErrMethodNotAllowed = ErrBadRequest.NewClass("Method not allowed",
		errhttp.SetStatusCode(http.StatusMethodNotAllowed))
	ErrInternalServerError = HTTPError.NewClass("Internal server error",
		errhttp.SetStatusCode(http.StatusInternalServerError))
	ErrUnauthorized = HTTPError.NewClass("Unauthorized",
		errhttp.SetStatusCode(http.StatusUnauthorized))
)

func Redirect(w ResponseWriter, r *http.Request, redirectTo string) error {
	http.Redirect(w, r, redirectTo, http.StatusSeeOther)
	return nil
}
Beispiel #3
0
import (
	"time"

	"github.com/spacemonkeygo/errors"
)

var (
	// Error is a generic error class for pwsafe.
	Error = errors.NewClass("pwsafe")

	// IOError represents an io error.
	IOError = Error.NewClass("io error")

	// BadPassphrase indicates that the passphrase was bad.
	BadPassphrase = Error.NewClass("bad passphrase", errors.NoCaptureStack())

	// BadTag indicates that the tag on the database file is unexpected.
	BadTag = Error.NewClass("bad tag", errors.NoCaptureStack())

	// Corrupted indicates that the database has been corrupted.
	Corrupted = Error.NewClass("corrupted", errors.NoCaptureStack())
)

// Database represents a pwsafe database.
type Database interface {

	// Version returns a version string for the database.
	Version() string

	// Header returns the database header.