...

Source file src/golang.org/x/crypto/openpgp/errors/errors.go

Documentation: golang.org/x/crypto/openpgp/errors

     1  // Copyright 2010 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package errors contains common error types for the OpenPGP packages.
     6  //
     7  // Deprecated: this package is unmaintained except for security fixes. New
     8  // applications should consider a more focused, modern alternative to OpenPGP
     9  // for their specific task. If you are required to interoperate with OpenPGP
    10  // systems and need a maintained package, consider a community fork.
    11  // See https://golang.org/issue/44226.
    12  package errors // import "golang.org/x/crypto/openpgp/errors"
    13  
    14  import (
    15  	"strconv"
    16  )
    17  
    18  // A StructuralError is returned when OpenPGP data is found to be syntactically
    19  // invalid.
    20  type StructuralError string
    21  
    22  func (s StructuralError) Error() string {
    23  	return "openpgp: invalid data: " + string(s)
    24  }
    25  
    26  // UnsupportedError indicates that, although the OpenPGP data is valid, it
    27  // makes use of currently unimplemented features.
    28  type UnsupportedError string
    29  
    30  func (s UnsupportedError) Error() string {
    31  	return "openpgp: unsupported feature: " + string(s)
    32  }
    33  
    34  // InvalidArgumentError indicates that the caller is in error and passed an
    35  // incorrect value.
    36  type InvalidArgumentError string
    37  
    38  func (i InvalidArgumentError) Error() string {
    39  	return "openpgp: invalid argument: " + string(i)
    40  }
    41  
    42  // SignatureError indicates that a syntactically valid signature failed to
    43  // validate.
    44  type SignatureError string
    45  
    46  func (b SignatureError) Error() string {
    47  	return "openpgp: invalid signature: " + string(b)
    48  }
    49  
    50  type keyIncorrectError int
    51  
    52  func (ki keyIncorrectError) Error() string {
    53  	return "openpgp: incorrect key"
    54  }
    55  
    56  var ErrKeyIncorrect error = keyIncorrectError(0)
    57  
    58  type unknownIssuerError int
    59  
    60  func (unknownIssuerError) Error() string {
    61  	return "openpgp: signature made by unknown entity"
    62  }
    63  
    64  var ErrUnknownIssuer error = unknownIssuerError(0)
    65  
    66  type keyRevokedError int
    67  
    68  func (keyRevokedError) Error() string {
    69  	return "openpgp: signature made by revoked key"
    70  }
    71  
    72  var ErrKeyRevoked error = keyRevokedError(0)
    73  
    74  type UnknownPacketTypeError uint8
    75  
    76  func (upte UnknownPacketTypeError) Error() string {
    77  	return "openpgp: unknown packet type: " + strconv.Itoa(int(upte))
    78  }
    79  

View as plain text