Exception: Datadog::Statsd::Schema::SchemaError Abstract

Inherits:
StandardError
  • Object
show all
Defined in:
lib/datadog/statsd/schema/errors.rb

Overview

This class is abstract.

Base class for schema validation errors

Base error class for all schema validation errors Provides context about where the error occurred including namespace, metric, and tag information

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, namespace: "<-no-namespace->", metric: "<-no-metric->", tag: "<-no-tag->") ⇒ SchemaError

Initialize a new schema error with context information

Parameters:

  • message (String, nil) (defaults to: nil)

    Custom error message, will be auto-generated if nil

  • namespace (String) (defaults to: "<-no-namespace->")

    Namespace context for the error

  • metric (String) (defaults to: "<-no-metric->")

    Metric context for the error

  • tag (String) (defaults to: "<-no-tag->")

    Tag context for the error

Since:

  • 0.1.0



35
36
37
38
39
40
41
42
# File 'lib/datadog/statsd/schema/errors.rb', line 35

def initialize(message = nil, namespace: "<-no-namespace->", metric: "<-no-metric->", tag: "<-no-tag->")
  @namespace = namespace
  @metric = metric
  @tag = tag
  message ||= "#{self.class.name.underscore.gsub("_", " ").split(".").map(&:capitalize).join(" ")} Error " \
              "{ namespace: #{namespace}, metric: #{metric}, tag: #{tag} }"
  super(message)
end

Instance Attribute Details

#metricString (readonly)

The metric name where the error occurred

Returns:

  • (String)

    Metric name or placeholder if not available

Since:

  • 0.1.0



24
25
26
# File 'lib/datadog/statsd/schema/errors.rb', line 24

def metric
  @metric
end

#namespaceString (readonly)

The namespace where the error occurred

Returns:

  • (String)

    Namespace path or placeholder if not available

Since:

  • 0.1.0



20
21
22
# File 'lib/datadog/statsd/schema/errors.rb', line 20

def namespace
  @namespace
end

#tagString (readonly)

The tag name where the error occurred

Returns:

  • (String)

    Tag name or placeholder if not available

Since:

  • 0.1.0



28
29
30
# File 'lib/datadog/statsd/schema/errors.rb', line 28

def tag
  @tag
end