faastruby 0.5.4 → 0.5.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
  SHA256:
3
- metadata.gz: 8af2923c5e62b4a22503fd132f37dee20e4d51a0c219330c1d374a4cd340d733
4
- data.tar.gz: eae1182098c73358cf91e8befae2bb6e31206270066f9c56a767a7cfe6c301c1
3
+ metadata.gz: 8a491f4abb96d8fa8365469a5cd1adec928ba2c775e05dedafbcce10924ef889
4
+ data.tar.gz: e20f906502710fb4b7bb5803a47e4844d183e254305766e8f5fff94341b5ef63
5
5
  SHA512:
6
- metadata.gz: e824ddcca989be2239d1b2e8149f88e0ec45d1bea5079266d788e9f3334488e0a1999b19e69c1b862e0cea55973a8e0c23815b244652425d801ee7cef4a08054
7
- data.tar.gz: e1dc90e3d642adc1b18343e463b58374a84e834e1a6194f3e0004a6f457012632637fee893b415248fbde306f5f56ca345fda4d846cab90b6ae2b6f6d88a8fdc
6
+ metadata.gz: 77f0c2999f8648cad2055da5a36917ece93849b7e243d5d0c512bde0406b2fffeb4a121686b5a420b4a4ed9ed49e3d10af3ada202bda8d2d9528fa3df675b8db
7
+ data.tar.gz: 22f7921d21da2357857f2b4e66bd0cc0c0334e0c2f610e8c4538abf629874889121e99efc835867a2645a709dce0611784a23568f8f3181ee88e20858698a969
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+
3
+ ## 0.5.5 - Mar 9 2019
4
+ - Use a class method inside FaaStRuby::Response to handle invalid response messages.
5
+
2
6
  ## 0.5.4 - Mar 8 2019
3
7
  - Fix invalid response error when functions return invalid responses
4
8
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faastruby (0.5.3)
4
+ faastruby (0.5.4)
5
5
  colorize (~> 0.8)
6
6
  faastruby-rpc (~> 0.2)
7
7
  listen (~> 3.1)
@@ -24,6 +24,16 @@ module FaaStRuby
24
24
  )
25
25
  end
26
26
 
27
+ def self.invalid_response
28
+ body = {'error' => "Your function must render a response. For example, render text: \"Hello World!\""}
29
+ body = Oj.dump(body)
30
+ new(
31
+ body: body,
32
+ status: 500,
33
+ headers: {'Content-Type' => 'application/json'}
34
+ )
35
+ end
36
+
27
37
  def self.from_payload(payload)
28
38
  from_json Base64.urlsafe_decode64(payload)
29
39
  end
@@ -64,7 +64,7 @@ module FaaStRuby
64
64
  function = load_function("#{@function_folder}/handler.rb")
65
65
  function_object.extend(function)
66
66
  response = function_object.handler(event, *args)
67
- raise FaaStRuby::InvalidResponseError unless response.is_a?(FaaStRuby::Response)
67
+ response = FaaStRuby::Response.invalid_response unless response.is_a?(FaaStRuby::Response)
68
68
  rescue Exception => e
69
69
  error = Oj.dump({
70
70
  'error' => e.message,
@@ -1,3 +1,3 @@
1
1
  module FaaStRuby
2
- VERSION = '0.5.4'
2
+ VERSION = '0.5.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faastruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda