oerror

package
v1.0.0-...-26db8b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Error types and error functions for the ogonori library

Index

Constants

This section is empty.

Variables

View Source
var ErrStaleGlobalProperties error

Functions

func ExtractCause

func ExtractCause(err error) error

ExtractCause will recurse down a "stack" of Trace errors until it gets to an error that is not of type Trace and return that. If an error not of type Trace is passed it, it is simply returned.

func GetFullTrace

func GetFullTrace(err error) string

GetFullTrace extracts an error "stack" trace for the Trace error wrappers down to the ultimate cause. If a non-Trace error is passed in then just the "Cause" info is returned.

Types

type ErrDataTypeMismatch

type ErrDataTypeMismatch struct {
	ExpectedDataType oschema.ODataType
	ExpectedGoType   string
	ActualValue      interface{}
}

InvalidDatabaseType is an Error that indicates that the db type value is not one that the OrientDB server will recognize. For OrientDB 2.x, the valid types are "document" or "graph". Constants for these values are provided in the obinary ogonori code base.

func (ErrDataTypeMismatch) Error

func (e ErrDataTypeMismatch) Error() string

type ErrInvalidConn

type ErrInvalidConn struct {
	Msg string
}

func (ErrInvalidConn) Error

func (e ErrInvalidConn) Error() string

type IncorrectNetworkRead

type IncorrectNetworkRead struct {
	Expected int
	Actual   int
}

func (IncorrectNetworkRead) Error

func (e IncorrectNetworkRead) Error() string

type InvalidDatabaseType

type InvalidDatabaseType struct {
	TypeRequested string
}

InvalidDatabaseType is an Error that indicates that the db type value is not one that the OrientDB server will recognize. For OrientDB 2.x, the valid types are "document" or "graph". Constants for these values are provided in the obinary ogonori code base.

func (InvalidDatabaseType) Error

func (e InvalidDatabaseType) Error() string

type OServerException

type OServerException struct {
	Classes  []string
	Messages []string
}

OServerException encapsulates Java-based Exceptions from the OrientDB server. OrientDB can return multiple exceptions for a single query/command, so they are all encapsulated in one ogonori OServerException object. Class = Java exception class Message = error message from the server

func (OServerException) Error

func (e OServerException) Error() string

type SessionNotInitialized

type SessionNotInitialized struct{}

SessionNotInitialized is an Error that indicates that no session was started before trying to issue a command to the OrientDB server or one of its databases.

func (SessionNotInitialized) Error

func (e SessionNotInitialized) Error() string

type Trace

type Trace struct {
	File  string
	Line  int
	Cause error
}

Trace is a wrapper struct for errors so we can preseve information about the call stack an error passes through. Trace implements the Error interface.

func NewTrace

func NewTrace(cause error) Trace

NewTrace creates a Trace Error wrapper that retains the underlying error ("cause") and the filename and line number of the previous call where 2 is subtracted from the line number. So it's usage is appropriate with this form of code:

err = DoSomething()
if err != nil {
    return oerror.NewTrace(err)  // line - 2 refers to the DoSomething() line
}

func (Trace) Error

func (e Trace) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL