Exemple #1
0
// GetInvalidMessageAsString gets the error message for this Jv. If there is none it
// will return ("", false). Otherwise it will return the message as a string and true,
// converting non-string values if necessary. If you want the message in it's
// native Jv type use `GetInvalidMessage()`
//
// Consumes the invocant.
func (jv *Jv) GetInvalidMessageAsString() (string, bool) {
	msg := C.jv_invalid_get_msg(jv.jv)
	defer C.jv_free(msg)

	if C.jv_get_kind(msg) == C.JV_KIND_NULL {
		return "", false
	} else if C.jv_get_kind(msg) != C.JV_KIND_STRING {
		msg = C.jv_dump_string(msg, 0)
	}
	return C.GoString(C.jv_string_value(msg)), true
}
Exemple #2
0
// GetInvalidMessage returns the message associcated
func (jv *Jv) GetInvalidMessage() *Jv {
	return &Jv{C.jv_invalid_get_msg(jv.jv)}
}