File tree Expand file tree Collapse file tree 3 files changed +39
-3
lines changed
lib/embulk/input/elasticsearch Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ def search_with_retry
7373 sleep 2 **retries
7474 retry
7575 end
76- Embulk . logger . error "Could not search to Elasticsearch after #{ retries } retries. #{ e . message } "
77- return nil
76+ msg = "Could not search to Elasticsearch after #{ retries } retries. #{ e . message } "
77+ raise Elasticsearch :: ConfigError ( e , msg )
7878 end
7979 end
8080
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def self.convert_value(value, field)
4040 when "json"
4141 value
4242 else
43- raise "Unsupported type #{ field [ 'type' ] } "
43+ raise Elasticsearch :: TypecastError . new "Unsupported type #{ field [ 'type' ] } "
4444 end
4545 end
4646 end
Original file line number Diff line number Diff line change 1+ module Embulk
2+ module Input
3+
4+ class Elasticsearch < InputPlugin
5+
6+ module Traceable
7+ def initialize ( e , more_msg = nil )
8+ message = e . is_a? ( String ) ? '' : "(#{ e . class } ) "
9+ message << "#{ e } #{ more_msg } \n "
10+ message << "\t at #{ e . backtrace . join ( "\n \t at " ) } \n " if e . respond_to? ( :backtrace )
11+
12+ while e . respond_to? ( :cause ) and e . cause
13+ # Java Exception cannot follow the JRuby causes.
14+ message << "Caused by (#{ e . cause . class } ) #{ e . cause } \n "
15+ message << "\t at #{ e . cause . backtrace . join ( "\n \t at " ) } \n " if e . cause . respond_to? ( :backtrace )
16+ e = e . cause
17+ end
18+
19+ super ( message )
20+ end
21+ end
22+
23+ class ConfigError < ::Embulk ::ConfigError
24+ include Traceable
25+ end
26+
27+ class DataError < ::Embulk ::DataError
28+ include Traceable
29+ end
30+
31+ class TypecastError < DataError
32+ end
33+
34+ end
35+ end
36+ end
You can’t perform that action at this time.
0 commit comments