github.com/qioalice/ekago/v3@v3.3.2-0.20221202205325-5c262d586ee4/ekaerr/init.go (about) 1 // Copyright © 2020-2021. All rights reserved. 2 // Author: Ilya Stroy. 3 // Contacts: iyuryevich@pm.me, https://github.com/qioalice 4 // License: https://opensource.org/licenses/MIT 5 6 package ekaerr 7 8 import ( 9 "github.com/qioalice/ekago/v3/internal/ekaletter" 10 11 "github.com/modern-go/reflect2" 12 ) 13 14 func init() { 15 errorPool.New = allocError 16 17 ekaletter.BridgeErrorGetLetter = bridgeGetLetter 18 19 ekaletter.BridgeErrorGetStackIdx = bridgeGetStackIdx 20 ekaletter.BridgeErrorSetStackIdx = bridgeSetStackIdx 21 22 // It's prohibited to use some types as Error's fields. 23 ignoredTypes := []uintptr{ 24 reflect2.RTypeOf(Class{}), reflect2.RTypeOf((*Class)(nil)), 25 reflect2.RTypeOf(Namespace{}), reflect2.RTypeOf((*Namespace)(nil)), 26 reflect2.RTypeOf(Error{}), reflect2.RTypeOf((*Error)(nil)), 27 } 28 ekaletter.RTypesBeingIgnoredForParsing = 29 append(ekaletter.RTypesBeingIgnoredForParsing, ignoredTypes...) 30 }