fluent-plugin-hipchat 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05583b44258b849316908fb2876939ac01ec29b3
4
- data.tar.gz: 77b650a614878b2abdfdf3bb27ccc37876c935eb
3
+ metadata.gz: 41892c64df61d3496d02924d73f14089e969ab09
4
+ data.tar.gz: 4d7545f990da26894984c0eb2e7148a7bf98567b
5
5
  SHA512:
6
- metadata.gz: bee6c20e5389de9d77134d07f402d0f57a58eb7930369b820155b30b766f5b09fcd01cb77588894c0b6dfcff9def758489a13c44a63dbe8df77924415f113e66
7
- data.tar.gz: e26c011ea2707f9c401e4f99ef1f775fcf9e07854e4363bf8c1275f415933cdbb121a444b381a4642f7bd88a07b43b23a8e38562f9a8cea404d559dcd439112d
6
+ metadata.gz: 0645335bd45ddafe75bd9fd034568a05083ef691408f2ab954ecd37b52b7f476744090b2ba3262b9c196444259e0e2528e03d71795eb484cf56e47f758d73476
7
+ data.tar.gz: f8883ccf6e965bf0eb74b24c64a224d005a8f4eefb09637405308f516613e1eb524ae1eca7a5b414369973e2fc5085507a1a575a783ff236ca9b900beeed3192
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -52,7 +52,7 @@ module Fluent
52
52
  send_message(record) if record['message']
53
53
  set_topic(record) if record['topic']
54
54
  rescue => e
55
- $log.error("HipChat Error: #{e} / #{e.message}")
55
+ $log.error("HipChat Error:", :error_class => e.class, :error => e.message)
56
56
  end
57
57
  end
58
58
  end
@@ -68,14 +68,16 @@ module Fluent
68
68
  end
69
69
  color = COLORS.include?(record['color']) ? record['color'] : @default_color
70
70
  message_format = FORMAT.include?(record['format']) ? record['format'] : @default_format
71
- @hipchat.rooms_message(room, from, message, notify, color, message_format)
71
+ response = @hipchat.rooms_message(room, from, message, notify, color, message_format)
72
+ raise StandardError, response['error']['message'].to_s if defined?(response['error']['message'])
72
73
  end
73
74
 
74
75
  def set_topic(record)
75
76
  room = record['room'] || @default_room
76
77
  from = record['from'] || @default_from
77
78
  topic = record['topic']
78
- @hipchat.rooms_topic(room, topic, from)
79
+ response = @hipchat.rooms_topic(room, topic, from)
80
+ raise StandardError, response['error']['message'].to_s if defined?(response['error']['message'])
79
81
  end
80
82
  end
81
83
  end
@@ -70,6 +70,26 @@ class HipchatOutputTest < Test::Unit::TestCase
70
70
  d.run
71
71
  end
72
72
 
73
+ def test_set_topic_response_error
74
+ d = create_driver
75
+ stub(d.instance.hipchat).rooms_topic('testroom', 'foo', 'testuser') {
76
+ {'error' => { 'code' => 400, 'type' => 'Bad Request', 'message' => 'Topic body must be between 1 and 250 characters.' } }
77
+ }
78
+ stub($log).error("HipChat Error:", :error_class => StandardError, :error => 'Topic body must be between 1 and 250 characters.')
79
+ d.emit({'topic' => 'foo'})
80
+ d.run
81
+ end
82
+
83
+ def test_send_message_response_error
84
+ d = create_driver
85
+ stub(d.instance.hipchat).rooms_message('testroom', '<abc>', 'foo', 0, 'yellow', 'html') {
86
+ {'error' => { 'code' => 400, 'type' => 'Bad Request', 'message' => 'From name may not contain HTML.' } }
87
+ }
88
+ stub($log).error("HipChat Error:", :error_class => StandardError, :error => 'From name may not contain HTML.')
89
+ d.emit({'from' => '<abc>', 'message' => 'foo'})
90
+ d.run
91
+ end
92
+
73
93
  def test_color_validate
74
94
  d = create_driver
75
95
  stub(d.instance.hipchat).rooms_message('testroom', 'testuser', 'foo', 0, 'yellow', 'html')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuichi Tateno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd