Class: Vellum::WorkflowEventError

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/workflow_event_error.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, raw_data: OMIT, code:, stacktrace: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowEventError

Parameters:



31
32
33
34
35
36
37
38
39
40
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 31

def initialize(message:, raw_data: OMIT, code:, stacktrace: OMIT, additional_properties: nil)
  @message = message
  @raw_data = raw_data if raw_data != OMIT
  @code = code
  @stacktrace = stacktrace if stacktrace != OMIT
  @additional_properties = additional_properties
  @_field_set = { "message": message, "raw_data": raw_data, "code": code, "stacktrace": stacktrace }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



18
19
20
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 18

def additional_properties
  @additional_properties
end

#code ⇒ Vellum::WorkflowExecutionEventErrorCode (readonly)



14
15
16
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 14

def code
  @code
end

#message ⇒ String (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 10

def message
  @message
end

#raw_data ⇒ Vellum::WorkflowEventErrorRawData (readonly)



12
13
14
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 12

def raw_data
  @raw_data
end

#stacktrace ⇒ String (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 16

def stacktrace
  @stacktrace
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkflowEventError

Parameters:

  • json_object (String)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 45

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  message = parsed_json["message"]
  unless parsed_json["raw_data"].nil?
    raw_data = parsed_json["raw_data"].to_json
    raw_data = Vellum::WorkflowEventErrorRawData.from_json(json_object: raw_data)
  else
    raw_data = nil
  end
  code = parsed_json["code"]
  stacktrace = parsed_json["stacktrace"]
  new(
    message: message,
    raw_data: raw_data,
    code: code,
    stacktrace: stacktrace,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


77
78
79
80
81
82
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 77

def self.validate_raw(obj:)
  obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
  obj.raw_data.nil? || Vellum::WorkflowEventErrorRawData.validate_raw(obj: obj.raw_data)
  obj.code.is_a?(Vellum::WorkflowExecutionEventErrorCode) != false || raise("Passed value for field obj.code is not the expected type, validation failed.")
  obj.stacktrace&.is_a?(String) != false || raise("Passed value for field obj.stacktrace is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


68
69
70
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 68

def to_json
  @_field_set&.to_json
end