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:, code:, raw_data: OMIT, stacktrace: OMIT, additional_properties: nil) ⇒ Vellum::WorkflowEventError

Parameters:

  • message (String)
  • code (Vellum::WorkflowExecutionEventErrorCode)
  • raw_data (Hash{String => Object}) (defaults to: OMIT)
  • stacktrace (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

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

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#codeVellum::WorkflowExecutionEventErrorCode (readonly)



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

def code
  @code
end

#messageString (readonly)

Returns:

  • (String)


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

def message
  @message
end

#raw_dataHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def raw_data
  @raw_data
end

#stacktraceString (readonly)

Returns:

  • (String)


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

def stacktrace
  @stacktrace
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::WorkflowEventError

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  message = parsed_json["message"]
  code = parsed_json["code"]
  raw_data = parsed_json["raw_data"]
  stacktrace = parsed_json["stacktrace"]
  new(
    message: message,
    code: code,
    raw_data: raw_data,
    stacktrace: stacktrace,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


71
72
73
74
75
76
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 71

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.code.is_a?(Vellum::WorkflowExecutionEventErrorCode) != false || raise("Passed value for field obj.code is not the expected type, validation failed.")
  obj.raw_data&.is_a?(Hash) != false || raise("Passed value for field obj.raw_data 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_jsonString

Returns:

  • (String)


62
63
64
# File 'lib/vellum_ai/types/workflow_event_error.rb', line 62

def to_json
  @_field_set&.to_json
end