summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exports/error.h8
-rw-r--r--exports/exports.go2
-rw-r--r--internal/log/log.go36
-rw-r--r--wrappers/python/eduvpn_common/error.py12
-rw-r--r--wrappers/python/eduvpn_common/types.py5
5 files changed, 4 insertions, 59 deletions
diff --git a/exports/error.h b/exports/error.h
index 64592e1..2f94bbc 100644
--- a/exports/error.h
+++ b/exports/error.h
@@ -1,15 +1,7 @@
#ifndef ERROR_H
#define ERROR_H
-typedef enum errorLevel {
- ERR_OTHER,
- ERR_INFO,
- ERR_WARNING,
- ERR_FATAL,
-} errorLevel;
-
typedef struct error {
- errorLevel level;
const char* traceback;
const char* cause;
} error;
diff --git a/exports/exports.go b/exports/exports.go
index 5a17da0..6e50f65 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -34,7 +34,6 @@ import (
"time"
"unsafe"
- "github.com/eduvpn/eduvpn-common/internal/log"
"github.com/eduvpn/eduvpn-common/internal/oauth"
"github.com/go-errors/errors"
@@ -172,7 +171,6 @@ func getError(err error) *C.error {
errorStruct.traceback = C.CString("N/A")
errorStruct.cause = C.CString(err.Error())
}
- errorStruct.level = C.errorLevel(log.GetErrorLevel(err))
return errorStruct
}
diff --git a/internal/log/log.go b/internal/log/log.go
index 16cf1fd..638f2ae 100644
--- a/internal/log/log.go
+++ b/internal/log/log.go
@@ -8,35 +8,10 @@ import (
"os"
"path"
- "github.com/eduvpn/eduvpn-common/internal/oauth"
"github.com/eduvpn/eduvpn-common/internal/util"
"github.com/go-errors/errors"
)
-type ErrLevel int8
-
-const (
- ErrOther ErrLevel = iota
- ErrInfo
- ErrWarning
- ErrFatal
-)
-
-func GetErrorLevel(err error) ErrLevel {
- // Get the inner error
- e := err
- if err1, ok := err.(*errors.Error); ok {
- e = err1.Err
- }
-
- switch e.(type) {
- case *oauth.CancelledCallbackError:
- return ErrInfo
- default:
- return ErrOther
- }
-}
-
// FileLogger defines the type of logger that this package implements
// As the name suggests, it saves the log to a file.
type FileLogger struct {
@@ -121,16 +96,7 @@ func (logger *FileLogger) Inherit(err error, msg string) {
return
}
s := "%s %s"
- switch GetErrorLevel(err) {
- case ErrInfo:
- logger.Infof(s, err.Error(), msg)
- case ErrWarning:
- logger.Warningf(s, err.Error(), msg)
- case ErrOther:
- logger.Errorf(s, err.Error(), msg)
- case ErrFatal:
- logger.Fatalf(s, err.Error(), msg)
- }
+ logger.Errorf(s, err.Error(), msg)
}
// Debugf logs a message with parameters as level LevelDebug.
diff --git a/wrappers/python/eduvpn_common/error.py b/wrappers/python/eduvpn_common/error.py
index 626d9a2..a642a70 100644
--- a/wrappers/python/eduvpn_common/error.py
+++ b/wrappers/python/eduvpn_common/error.py
@@ -1,23 +1,13 @@
from enum import Enum
-class ErrorLevel(Enum):
- """The error level enum"""
- ERR_OTHER = 0
- ERR_INFO = 1
- ERR_WARNING = 2
- ERR_FATAL = 3
-
-
class WrappedError(Exception):
"""An exception returned by the Go library
:param: traceback: str: The traceback of the error including newlines
:param: cause: str: The cause of the error as a message
- :param: level: ErrorLevel: The level of the error
"""
- def __init__(self, traceback: str, cause: str, level: ErrorLevel):
+ def __init__(self, traceback: str, cause: str):
super(WrappedError, self).__init__(cause)
self.traceback = traceback
self.cause = cause
- self.level = level
diff --git a/wrappers/python/eduvpn_common/types.py b/wrappers/python/eduvpn_common/types.py
index e4f8e26..c1d9848 100644
--- a/wrappers/python/eduvpn_common/types.py
+++ b/wrappers/python/eduvpn_common/types.py
@@ -13,7 +13,7 @@ from ctypes import (
)
from typing import Any, Callable, Iterator, List, Optional, Tuple
-from eduvpn_common.error import ErrorLevel, WrappedError
+from eduvpn_common.error import WrappedError
class cToken(Structure):
"""The C type that represents the Token as forwarded to the Go library
@@ -40,7 +40,6 @@ class cError(Structure):
:meta private:
"""
_fields_ = [
- ("level", c_int),
("traceback", c_char_p),
("cause", c_char_p),
]
@@ -273,7 +272,7 @@ def get_error(lib: CDLL, ptr: c_void_p) -> Optional[WrappedError]:
return None
err = cast(ptr, POINTER(cError)).contents
wrapped = WrappedError(
- err.traceback.decode("utf-8"), err.cause.decode("utf-8"), ErrorLevel(err.level)
+ err.traceback.decode("utf-8"), err.cause.decode("utf-8")
)
lib.FreeError(ptr)
return wrapped