diff options
| author | Russ Cox <rsc@golang.org> | 2012-01-25 15:31:12 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-01-25 15:31:12 -0500 |
| commit | 470549d5029af744f2f91c2c66a10efc5bc871f8 (patch) | |
| tree | 3c25ee1ef3ee3355419b275ecec84cf848771b7e /openpgp/errors/errors.go | |
| parent | f61fbb80d2fc0f581f66365e8907f07a4d7506b0 (diff) | |
| download | go-x-crypto-470549d5029af744f2f91c2c66a10efc5bc871f8.tar.xz | |
go.crypto: initial code
Manual edits to README.
Moved from main Go repository, deleted Makefiles, ran gofix -r go1rename.
Tested with: go test code.google.com/p/go.crypto/...
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5564059
Diffstat (limited to 'openpgp/errors/errors.go')
| -rw-r--r-- | openpgp/errors/errors.go | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/openpgp/errors/errors.go b/openpgp/errors/errors.go new file mode 100644 index 0000000..b9016bd --- /dev/null +++ b/openpgp/errors/errors.go @@ -0,0 +1,64 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package errors contains common error types for the OpenPGP packages. +package errors + +import ( + "strconv" +) + +// A StructuralError is returned when OpenPGP data is found to be syntactically +// invalid. +type StructuralError string + +func (s StructuralError) Error() string { + return "OpenPGP data invalid: " + string(s) +} + +// UnsupportedError indicates that, although the OpenPGP data is valid, it +// makes use of currently unimplemented features. +type UnsupportedError string + +func (s UnsupportedError) Error() string { + return "OpenPGP feature unsupported: " + string(s) +} + +// InvalidArgumentError indicates that the caller is in error and passed an +// incorrect value. +type InvalidArgumentError string + +func (i InvalidArgumentError) Error() string { + return "OpenPGP argument invalid: " + string(i) +} + +// SignatureError indicates that a syntactically valid signature failed to +// validate. +type SignatureError string + +func (b SignatureError) Error() string { + return "OpenPGP signature invalid: " + string(b) +} + +type keyIncorrectError int + +func (ki keyIncorrectError) Error() string { + return "the given key was incorrect" +} + +var ErrKeyIncorrect error = keyIncorrectError(0) + +type unknownIssuerError int + +func (unknownIssuerError) Error() string { + return "signature make by unknown entity" +} + +var ErrUnknownIssuer error = unknownIssuerError(0) + +type UnknownPacketTypeError uint8 + +func (upte UnknownPacketTypeError) Error() string { + return "unknown OpenPGP packet type: " + strconv.Itoa(int(upte)) +} |
