github.com/sberex/go-sberex@v1.8.2-0.20181113200658-ed96ac38f7d7/crypto/secp256k1/panic_cb.go (about) 1 // This file is part of the go-sberex library. The go-sberex library is 2 // free software: you can redistribute it and/or modify it under the terms 3 // of the GNU Lesser General Public License as published by the Free 4 // Software Foundation, either version 3 of the License, or (at your option) 5 // any later version. 6 // 7 // The go-sberex library is distributed in the hope that it will be useful, 8 // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 10 // General Public License <http://www.gnu.org/licenses/> for more details. 11 12 package secp256k1 13 14 import "C" 15 import "unsafe" 16 17 // Callbacks for converting libsecp256k1 internal faults into 18 // recoverable Go panics. 19 20 //export secp256k1GoPanicIllegal 21 func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) { 22 panic("illegal argument: " + C.GoString(msg)) 23 } 24 25 //export secp256k1GoPanicError 26 func secp256k1GoPanicError(msg *C.char, data unsafe.Pointer) { 27 panic("internal error: " + C.GoString(msg)) 28 }