Every line of 'err to string golang' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.
16 func getErrString() string { 17 e := C.ERR_get_error() 18 19 buf := [120]byte{} // max length specified in OpenSSL doc 20 bufp := (*_Ctype_char)(unsafe.Pointer(&buf[0])) 21 C.ERR_error_string_n(e, bufp, C.size_t(len(buf))) 22 23 return string(buf[:C.strlen(bufp)]) 24 }
422 func errString(err error) (s string) { 423 s = "success" 424 if err != nil { 425 s = err.Error() 426 } 427 return 428 }
83 func (e errorCString) Error() string { 84 return "runtime error: " + cstringToGo(e.cstr) 85 }
108 func ErrorToString(err int) string { 109 110 // API: char * ldap_err2string (int err ) 111 result := C.GoString(C.to_charptr(unsafe.Pointer(C.ldap_err2string(C.int(err))))) 112 return result 113 }
21 func (not *PublishReceipt) ToString() string { 22 if not.Success { 23 return fmt.Sprintf("[LetterID: %s] - Publish successful.\r\n", not.LetterID.String()) 24 } 25 26 return fmt.Sprintf("[LetterID: %s] - Publish failed.\r\nError: %s\r\n", not.LetterID.String(), not.Error.Error()) 27 }
40 func ErrorToString(err error) string { 41 if err == nil { 42 return "" 43 } 44 return err.Error() 45 }
521 func (err *ParseError) ToString(escape bool) string { 522 return err.Error() 523 }
49 func toString(v interface{}) string { 50 switch t := v.(type) { 51 case byte: 52 return string(t) 53 case rune: 54 return string(t) 55 case string: 56 return t 57 case []byte: 58 var b strings.Builder 59 b.WriteByte('[') 60 for i := range t { 61 if i > 0 { 62 b.WriteString(", ") 63 } 64 b.WriteString(strconv.Itoa(int(t[i]))) 65 } 66 b.WriteByte(']') 67 return b.String() 68 case Stringer: 69 return t.String() 70 case int: 71 return strconv.Itoa(t) 72 case error: 73 return t.Error() 74 default: 75 panic("incompatible type") 76 } 77 }
95 func (h *CErrorHandler) ConvertGoInt(iError int) error { 96 return h.Convert(C.int(iError)) 97 }
311 func (m *RGOnlineRes) GetErrStr() string { 312 if m != nil { 313 return m.ErrStr 314 } 315 return "" 316 }