lib/skylight/errors.rb in skylight-4.3.2 vs lib/skylight/errors.rb in skylight-5.0.0.beta
- old
+ new
@@ -1,6 +1,11 @@
+require "json"
+
module Skylight
+ # @api private
+ class ConfigError < RuntimeError; end
+
class NativeError < StandardError
@classes = {}
def self.register(code, name, message)
if @classes.key?(code)
@@ -27,32 +32,42 @@
def self.code
9999
end
+ def self.formatted_code
+ format("%<code>04d", code: code)
+ end
+
def self.message
"Encountered an unknown internal error"
end
def initialize(method_name)
@method_name = method_name
- super(format("[E%<code>04d] %<message>s [%<meth>s]", code: code, message: message, meth: method_name))
+ super(format("[E%<code>04d] %<message>s [%<meth>s]", code: code, message: self.class.message, meth: method_name))
end
def code
self.class.code
end
def formatted_code
- format("%04d", code)
+ self.class.formatted_code
end
+ # E0002
+ # Too many unique descriptions - daemon only
+
# E0003
register(3, "MaximumTraceSpans", "Exceeded maximum number of spans in a trace.")
# E0004
register(4, "SqlLex", "Failed to lex SQL query.")
# E0005
register(5, "InstrumenterUnrecoverable", "Instrumenter is not running.")
+
+ # E0006
+ register(6, "InvalidUtf8", "Invalid UTF-8")
end
end