File: errors.go

package info (click to toggle)
golang-github-dromara-dongle 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,440 kB
  • sloc: makefile: 4
file content (26 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download
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
package base58

import "fmt"

// AlphabetSizeError represents an error when the base58 alphabet is invalid.
// Base58 requires an alphabet of exactly 58 characters for proper encoding
// and decoding operations. This error occurs when the alphabet length
// does not meet this requirement.
type AlphabetSizeError int

// Error returns a formatted error message describing the invalid alphabet length.
// The message includes the actual length and the required length for debugging.
func (e AlphabetSizeError) Error() string {
	return fmt.Sprintf("coding/base58: invalid alphabet, the alphabet length must be 58, got %d", int(e))
}

// CorruptInputError represents an error when corrupted or invalid base58 data
// is detected during decoding. This error occurs when an invalid character
// is found in the input or when the input data is malformed.
type CorruptInputError int64

// Error returns a formatted error message describing the corrupted input.
// The message includes the position where corruption was detected.
func (e CorruptInputError) Error() string {
	return fmt.Sprintf("coding/base58: illegal data at input byte %d", int64(e))
}