github.com/guiltylotus/go-ethereum@v1.9.7/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  package secp256k1
     6  
     7  import "C"
     8  import "unsafe"
     9  
    10  // Callbacks for converting libsecp256k1 internal faults into
    11  // recoverable Go panics.
    12  
    13  //export secp256k1GoPanicIllegal
    14  func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) {
    15  	panic("illegal argument: " + C.GoString(msg))
    16  }
    17  
    18  //export secp256k1GoPanicError
    19  func secp256k1GoPanicError(msg *C.char, data unsafe.Pointer) {
    20  	panic("internal error: " + C.GoString(msg))
    21  }