omnata-plugin-runtime 0.1.4__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: A development kit to assist with building, testing and publishing Omnata Plugins
5
5
  Author: James Weakley
6
6
  Author-email: james.weakley@omnata.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.1.4"
3
+ version = "0.1.6"
4
4
  description = "A development kit to assist with building, testing and publishing Omnata Plugins"
5
5
  authors = ["James Weakley <james.weakley@omnata.com>"]
6
6
  readme = "README.md"
@@ -10,7 +10,7 @@ import pandas
10
10
  from snowflake.snowpark import Session
11
11
  from pydantic import ValidationError
12
12
 
13
- class CustomLogger(logging.Logger):
13
+ class CustomLogger(logging.getLoggerClass()):
14
14
  """
15
15
  Custom logger that can handle pydantic validation errors.
16
16
  Without this, you get "Object of type ErrorWrapper is not JSON serializable"
@@ -18,7 +18,12 @@ class CustomLogger(logging.Logger):
18
18
  """
19
19
  def error(self, msg, *args, **kwargs):
20
20
  if isinstance(msg, ValidationError):
21
- msg = msg.errors()
21
+ # If the exc_info or stack_info flags are set, unset them and manually
22
+ # add the error information to the log message.
23
+ exc_info = kwargs.pop('exc_info', False)
24
+ stack_info = kwargs.pop('stack_info', False)
25
+ if exc_info or stack_info:
26
+ msg = f"{msg.errors()} (originally raised at {msg.__traceback__.tb_frame.f_code.co_filename}:{msg.__traceback__.tb_lineno})"
22
27
  super().error(msg, *args, **kwargs)
23
28
 
24
29
  class OmnataPluginLogHandler(logging.handlers.BufferingHandler):