jflow 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/jflow/activity/task.rb +15 -0
- data/lib/jflow/activity/worker.rb +1 -0
- data/lib/jflow/configuration.rb +2 -1
- data/lib/jflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 960a8f21a063f379ca90a83d8ff0755251d6de18
|
4
|
+
data.tar.gz: 1b18e34ab879287ff16008aac79c2d4604688250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a32307b41cefa618afb109e24d4c45b92ca9a9493d3558c4aa6fcd62306f28a0336e070a96c9344faa329db77eea9ed98ba48422d778dacba35cb579487e4d6
|
7
|
+
data.tar.gz: 6051f0c1c0063372303d76c51d136b53554912b42d26ead5847cee611ea6579c995a026a1a96cf4c0436da238fb0a3a277df4aaa5280d10b5f610bf56e49c8c4
|
data/README.md
CHANGED
@@ -71,6 +71,14 @@ Example of a worker.json
|
|
71
71
|
}
|
72
72
|
```
|
73
73
|
|
74
|
+
### Error Handlers
|
75
|
+
|
76
|
+
You can attach your own error handler for error logging or exception handling by providing a service that responds to `call(exception)`. If you are using Sentry, you can add Raven as error handler:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
JFlow.configuration.error_handlers << Proc.new { |e| Raven.capture_exception(e) }
|
80
|
+
```
|
81
|
+
|
74
82
|
## Development
|
75
83
|
|
76
84
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/jflow/activity/task.rb
CHANGED
@@ -91,6 +91,17 @@ module JFlow
|
|
91
91
|
)
|
92
92
|
end
|
93
93
|
|
94
|
+
def handle_exception(exception)
|
95
|
+
JFlow.configuration.error_handlers.each do |error_handler|
|
96
|
+
begin
|
97
|
+
error_handler.call(exception)
|
98
|
+
rescue => e
|
99
|
+
log_error("Error handler failed!")
|
100
|
+
log_error(e.backtrace.join("\n")) unless e.backtrace.nil?
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
94
105
|
private
|
95
106
|
|
96
107
|
def retryable?(exception)
|
@@ -113,6 +124,10 @@ module JFlow
|
|
113
124
|
def log(str)
|
114
125
|
JFlow.configuration.logger.info "[#{Thread.current.object_id}] #{str}"
|
115
126
|
end
|
127
|
+
|
128
|
+
def log_error(str)
|
129
|
+
JFlow.configuration.logger.error "[#{Thread.current.object_id}] #{str}"
|
130
|
+
end
|
116
131
|
end
|
117
132
|
end
|
118
133
|
end
|
data/lib/jflow/configuration.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module JFlow
|
2
2
|
class Configuration
|
3
3
|
|
4
|
-
attr_accessor :swf_client, :load_paths, :logger, :activity_map, :cloudwatch_client
|
4
|
+
attr_accessor :swf_client, :load_paths, :logger, :activity_map, :cloudwatch_client, :error_handlers
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@swf_client = nil
|
@@ -9,6 +9,7 @@ module JFlow
|
|
9
9
|
@load_paths = []
|
10
10
|
@logger = Logger.new(STDOUT)
|
11
11
|
@activity_map = JFlow::Activity::Map.new
|
12
|
+
@error_handlers = []
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
data/lib/jflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christophe Verbinnen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|