github.com/RevenueMonster/sqlike@v1.0.6/jsonb/errors.go (about)

     1  package jsonb
     2  
     3  import (
     4  	"reflect"
     5  )
     6  
     7  // ErrInvalidJSON :
     8  type ErrInvalidJSON struct {
     9  	callback string
    10  	message  string
    11  }
    12  
    13  func (e ErrInvalidJSON) Error() string {
    14  	return "jsonb." + e.callback + ": " + e.message
    15  }
    16  
    17  // ErrNoEncoder :
    18  type ErrNoEncoder struct {
    19  	Type reflect.Type
    20  }
    21  
    22  func (err ErrNoEncoder) Error() (msg string) {
    23  	if err.Type == nil {
    24  		msg = "no encoder for <nil>"
    25  		return
    26  	}
    27  	msg = "no encoder for " + err.Type.String()
    28  	return
    29  }
    30  
    31  // ErrNoDecoder :
    32  type ErrNoDecoder struct {
    33  	Type reflect.Type
    34  }
    35  
    36  func (err ErrNoDecoder) Error() (msg string) {
    37  	if err.Type == nil {
    38  		msg = "no decoder for <nil>"
    39  		return
    40  	}
    41  	msg = "no decoder for " + err.Type.String()
    42  	return
    43  }