github.com/aquanetwork/aquachain@v1.7.8/crypto/secp256k1/panic_cb.go (about)

     1  // Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  // +build gccgo cgo !nocgo
     6  
     7  package secp256k1
     8  
     9  import "C"
    10  import "unsafe"
    11  
    12  // Callbacks for converting libsecp256k1 internal faults into
    13  // recoverable Go panics.
    14  
    15  //export secp256k1GoPanicIllegal
    16  func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) {
    17  	panic("illegal argument: " + C.GoString(msg))
    18  }
    19  
    20  //export secp256k1GoPanicError
    21  func secp256k1GoPanicError(msg *C.char, data unsafe.Pointer) {
    22  	panic("internal error: " + C.GoString(msg))
    23  }