MCPcopy Create free account
hub / github.com/lib/pq / parseError

Function parseError

error.go:127–169  ·  view source on GitHub ↗
(r *readBuf, q string)

Source from the content-addressed store, hash-verified

125)
126
127func parseError(r *readBuf, q string) *Error {
128 err := &Error{query: q}
129 for t := r.byte(); t != 0; t = r.byte() {
130 msg := r.string()
131 switch t {
132 case 'S':
133 err.Severity = msg
134 case 'C':
135 err.Code = pqerror.Code(msg)
136 case 'M':
137 err.Message = msg
138 case 'D':
139 err.Detail = msg
140 case 'H':
141 err.Hint = msg
142 case 'P':
143 err.Position = msg
144 case 'p':
145 err.InternalPosition = msg
146 case 'q':
147 err.InternalQuery = msg
148 case 'W':
149 err.Where = msg
150 case 's':
151 err.Schema = msg
152 case 't':
153 err.Table = msg
154 case 'c':
155 err.Column = msg
156 case 'd':
157 err.DataTypeName = msg
158 case 'n':
159 err.Constraint = msg
160 case 'F':
161 err.File = msg
162 case 'L':
163 err.Line = msg
164 case 'R':
165 err.Routine = msg
166 }
167 }
168 return err
169}
170
171// Fatal returns true if the Error Severity is fatal.
172func (e *Error) Fatal() bool { return e.Severity == pqerror.SeverityFatal }

Callers 15

prepareCopyInMethod · 0.85
resploopMethod · 0.85
simpleExecMethod · 0.85
simpleQueryMethod · 0.85
recvMethod · 0.85
recv1BufMethod · 0.85
readReadyForQueryMethod · 0.85
readParseResponseMethod · 0.85
readBindResponseMethod · 0.85
postExecuteWorkaroundMethod · 0.85

Calls 3

CodeTypeAlias · 0.92
byteMethod · 0.45
stringMethod · 0.45

Tested by 1

TestErrorSQLStateFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…