Class: Google::Cloud::Debugger::Breakpoint::StatusMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/debugger/breakpoint/status_message.rb

Overview

StatusMessage

Represents a contextual status message. The message can indicate an error or informational status, and refer to specific parts of the containing object. For example, the Breakpoint.status field can indicate an error referring to the BREAKPOINT_SOURCE_LOCATION with the message Location not found.

Constant Summary collapse

UNSPECIFIED =

Constants used as references to which the message applies.

:UNSPECIFIED
BREAKPOINT_SOURCE_LOCATION =
:BREAKPOINT_SOURCE_LOCATION
BREAKPOINT_CONDITION =
:BREAKPOINT_CONDITION
BREAKPOINT_EXPRESSION =
:BREAKPOINT_EXPRESSION
BREAKPOINT_AGE =
:BREAKPOINT_AGE
VARIABLE_NAME =
:VARIABLE_NAME
VARIABLE_VALUE =
:VARIABLE_VALUE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Status message text.



49
50
51
# File 'lib/google/cloud/debugger/breakpoint/status_message.rb', line 49

def description
  @description
end

#is_errorObject

Distinguishes errors from informational messages.



41
42
43
# File 'lib/google/cloud/debugger/breakpoint/status_message.rb', line 41

def is_error
  @is_error
end

#refers_toObject

Reference to which the message applies.



45
46
47
# File 'lib/google/cloud/debugger/breakpoint/status_message.rb', line 45

def refers_to
  @refers_to
end

Class Method Details

.from_grpc(grpc) ⇒ Object

New Google::Cloud::Debugger::Breakpoint::StatusMessage from a Google::Cloud::Debugger::V2::StatusMessage object.



54
55
56
57
58
59
60
61
# File 'lib/google/cloud/debugger/breakpoint/status_message.rb', line 54

def self.from_grpc grpc
  return nil if grpc.nil?
  new.tap do |s|
    s.is_error = grpc.is_error
    s.refers_to = grpc.refers_to
    s.description = grpc.description.format
  end
end

Instance Method Details

#to_grpcObject

Exports the StatusMessage to a Google::Cloud::Debugger::V2::StatusMessage object.



80
81
82
83
84
85
86
87
88
# File 'lib/google/cloud/debugger/breakpoint/status_message.rb', line 80

def to_grpc
  return nil if empty?
  description_grpc = Google::Cloud::Debugger::V2::FormatMessage.new format: description.to_s

  Google::Cloud::Debugger::V2::StatusMessage.new \
    is_error: true,
    refers_to: refers_to,
    description: description_grpc
end