File: packet_unsupported.go

package info (click to toggle)
golang-github-protonmail-go-crypto 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,932 kB
  • sloc: makefile: 10
file content (24 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package packet

import (
	"io"

	"github.com/ProtonMail/go-crypto/openpgp/errors"
)

// UnsupportedPackage represents a OpenPGP packet with a known packet type
// but with unsupported content.
type UnsupportedPacket struct {
	IncompletePacket Packet
	Error            errors.UnsupportedError
}

// Implements the Packet interface
func (up *UnsupportedPacket) parse(read io.Reader) error {
	err := up.IncompletePacket.parse(read)
	if castedErr, ok := err.(errors.UnsupportedError); ok {
		up.Error = castedErr
		return nil
	}
	return err
}