Method: Cisco::Client::GRPC#handle_text_error

Defined in:
lib/cisco_node_utils/client/grpc/client.rb

#handle_text_error(args, msg) ⇒ Object

Generate an error from a failed request



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/cisco_node_utils/client/grpc/client.rb', line 314

def handle_text_error(args, msg)
  if /^Disallowed commands:/ =~ msg
    fail Cisco::RequestNotSupported, msg
  elsif args.is_a?(ConfigGetArgs) || args.is_a?(ConfigArgs)
    fail Cisco::YangError.new( # rubocop:disable Style/RaiseArgs
      rejected_input: args.yangpathjson,
      error:          msg,
    )
  else
    fail Cisco::CliError.new( # rubocop:disable Style/RaiseArgs
      rejected_input: args.cli,
      clierror:       msg,
    )
  end
end