Class: VertxWebClient::ErrorConverter

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb

Overview

Converts a ResponsePredicateResult to a Throwable describing the error.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

18
19
20
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 18

def @@j_api_type.accept?(obj)
  obj.class == ErrorConverter
end

+ (::VertxWebClient::ErrorConverter) create(converter = nil) { ... }

Creates a full VertxWebClient::ErrorConverter, that will passed a predicate result with the response body.

The converter function will be invoked after the HTTP response body is received.

Yields:

Returns:

Raises:

  • (ArgumentError)

38
39
40
41
42
43
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 38

def self.create(converter=nil)
  if block_given? && converter == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebClientPredicate::ErrorConverter.java_method(:create, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_throwable(yield(::Vertx::Util::Utils.safe_create(event,::VertxWebClient::ResponsePredicateResult))) })),::VertxWebClient::ErrorConverter)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{converter})"
end

+ (::VertxWebClient::ErrorConverter) create_full_body(converter = nil) { ... }

Creates a full VertxWebClient::ErrorConverter, that will passed a predicate result with the response body.

The converter function will be invoked after the HTTP response body is received.

Yields:

Returns:

Raises:

  • (ArgumentError)

49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 49

def self.create_full_body(converter=nil)
  if block_given? && converter == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebClientPredicate::ErrorConverter.java_method(:createFullBody, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_throwable(yield(::Vertx::Util::Utils.safe_create(event,::VertxWebClient::ResponsePredicateResult))) })),::VertxWebClient::ErrorConverter)
  end
  raise ArgumentError, "Invalid arguments when calling create_full_body(#{converter})"
end

+ (Object) DEFAULT_CONVERTER


70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 70

def self.DEFAULT_CONVERTER
  ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebClientPredicate::ErrorConverter.DEFAULT_CONVERTER,::VertxWebClient::ErrorConverter)
end

+ (Object) j_api_type


27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 30

def self.j_class
  Java::IoVertxExtWebClientPredicate::ErrorConverter.java_class
end

+ (Object) unwrap(obj)


24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 24

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)


21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 21

def @@j_api_type.wrap(obj)
  ErrorConverter.new(obj)
end

Instance Method Details

- (Exception) apply(result = nil)

Parameters:

Returns:

  • (Exception)

Raises:

  • (ArgumentError)

57
58
59
60
61
62
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 57

def apply(result=nil)
  if result.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.from_throwable(@j_del.java_method(:apply, [Java::IoVertxExtWebClientPredicate::ResponsePredicateResult.java_class]).call(result.j_del))
  end
  raise ArgumentError, "Invalid arguments when calling apply(#{result})"
end

- (true, false) requires_body?

Returns true when the converter wants to process the request body.

Returns:

  • (true, false)
    true when the converter wants to process the request body.

Raises:

  • (ArgumentError)

64
65
66
67
68
69
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-client/error_converter.rb', line 64

def requires_body?
  if !block_given?
    return @j_del.java_method(:requiresBody, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling requires_body?()"
end