123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package maxminddb
- import (
- "fmt"
- "reflect"
- )
- type InvalidDatabaseError struct {
- message string
- }
- func newOffsetError() InvalidDatabaseError {
- return InvalidDatabaseError{"unexpected end of database"}
- }
- func newInvalidDatabaseError(format string, args ...interface{}) InvalidDatabaseError {
- return InvalidDatabaseError{fmt.Sprintf(format, args...)}
- }
- func (e InvalidDatabaseError) Error() string {
- return e.message
- }
- type UnmarshalTypeError struct {
- Value string
- Type reflect.Type
- }
- func newUnmarshalTypeError(value interface{}, rType reflect.Type) UnmarshalTypeError {
- return UnmarshalTypeError{
- Value: fmt.Sprintf("%v", value),
- Type: rType,
- }
- }
- func (e UnmarshalTypeError) Error() string {
- return fmt.Sprintf("maxminddb: cannot unmarshal %s into type %s", e.Value, e.Type.String())
- }
|