taldir

Directory service to resolve wallet mailboxes by messenger addresses
Log | Files | Refs | Submodules | README | LICENSE

pqerror.go (1044B)


      1 //go:generate go run gen.go
      2 
      3 // Package pqerror contains PostgreSQL error codes for use with pq.Error.
      4 package pqerror
      5 
      6 // Code is a five-character error code.
      7 type Code string
      8 
      9 // Name returns a more human friendly rendering of the error code, namely the
     10 // "condition name".
     11 func (ec Code) Name() string { return errorCodeNames[ec] }
     12 
     13 // Class returns the error class, e.g. "28".
     14 func (ec Code) Class() Class { return Class(ec[:2]) }
     15 
     16 // Class is only the class part of an error code.
     17 type Class string
     18 
     19 // Name returns the condition name of an error class.  It is equivalent to the
     20 // condition name of the "standard" error code (i.e. the one having the last
     21 // three characters "000").
     22 func (ec Class) Name() string { return errorCodeNames[Code(ec+"000")] }
     23 
     24 // TODO(v2): use "type Severity string" for the below.
     25 
     26 // Error severity values.
     27 const (
     28 	SeverityFatal   = "FATAL"
     29 	SeverityPanic   = "PANIC"
     30 	SeverityWarning = "WARNING"
     31 	SeverityNotice  = "NOTICE"
     32 	SeverityDebug   = "DEBUG"
     33 	SeverityInfo    = "INFO"
     34 	SeverityLog     = "LOG"
     35 )