-
Notifications
You must be signed in to change notification settings - Fork 47
/
errors.go
58 lines (45 loc) · 1.61 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2017-2021 the LinuxBoot 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 fit
import (
"fmt"
"github.com/linuxboot/fiano/pkg/intel/metadata/fit/consts"
)
// ErrACMInvalidKeySize means ACM entry has invalid key size
type ErrACMInvalidKeySize struct {
ExpectedKeySize uint64
RealKeySize uint64
}
func (err *ErrACMInvalidKeySize) Error() string {
return fmt.Sprintf("invalid key size, expected:%d, real:%d",
err.ExpectedKeySize, err.RealKeySize)
}
// ErrUnknownACMHeaderVersion means ACM entry has invalid header version
type ErrUnknownACMHeaderVersion struct {
ACHeaderVersion ACModuleHeaderVersion
}
func (err *ErrUnknownACMHeaderVersion) Error() string {
return fmt.Sprintf("unknown ACM header version: %#v", err.ACHeaderVersion)
}
// ErrInvalidTXTPolicyRecordVersion means TXT Policy entry has invalid version.
type ErrInvalidTXTPolicyRecordVersion struct {
EntryVersion EntryVersion
}
func (err *ErrInvalidTXTPolicyRecordVersion) Error() string {
return fmt.Sprintf("invalid TXT policy record version: %v", err.EntryVersion)
}
// ErrExpectedFITHeadersMagic means FIT magic string was not found where
// it was expected.
type ErrExpectedFITHeadersMagic struct {
Received []byte
}
func (err *ErrExpectedFITHeadersMagic) Error() string {
return fmt.Sprintf("string '%s' was expected as the Address value of the FIT header entry, but received: '%s'",
consts.FITHeadersMagic, err.Received)
}
// ErrNotFound literally means "not found".
type ErrNotFound struct{}
func (ErrNotFound) Error() string {
return "not found"
}