mirror of
https://github.com/Kagami/go-face.git
synced 2025-09-27 03:55:51 +08:00
43 lines
723 B
Go
43 lines
723 B
Go
package dlib
|
|
|
|
// #include "facerec.h"
|
|
import "C"
|
|
|
|
type ImageLoadError string
|
|
|
|
func (e ImageLoadError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
type SerializationError string
|
|
|
|
func (e SerializationError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
type RecognizeError string
|
|
|
|
func (e RecognizeError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
type UnknownError string
|
|
|
|
func (e UnknownError) Error() string {
|
|
return string(e)
|
|
}
|
|
|
|
// Construct Go error from passed error info.
|
|
func makeError(s string, code int) error {
|
|
switch code {
|
|
case C.IMAGE_LOAD_ERROR:
|
|
return ImageLoadError(s)
|
|
case C.SERIALIZATION_ERROR:
|
|
return SerializationError(s)
|
|
case C.RECOGNIZE_ERROR:
|
|
return RecognizeError(s)
|
|
default:
|
|
return UnknownError(s)
|
|
}
|
|
}
|