Standard library / crypto/aes
crypto/aes.KeySizeError
Reports the invalid key length in bytes. Use errors.As to classify constructor failures rather than parsing the text. Expected stdout: 'true 0\n'.
Formal Syntax & Structure
go syntaxgo
type KeySizeError intWorking Example
Example Snippetgo
package main
import ( "crypto/aes" "errors" "fmt")
func main() { _, err := aes.NewCipher(nil) var k aes.KeySizeError fmt.Println(errors.As(err, &k), int(k))}func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}