another_place 0.0.5 → 0.0.6

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: ae62f1eaef5217675930e436c0f24493282117d0
4
- data.tar.gz: 810c82feaee65138da8af691fa9fe712e0b5b979
3
+ metadata.gz: a610ea4053497206ae2aca87a589b41146d2722a
4
+ data.tar.gz: 915ec70822d9beb53a132bee68f081896da7555b
5
5
  SHA512:
6
- metadata.gz: f4762db8f7bd18fea780573583ba91188acc6a6cfc8569e31aee09a2434a774e359d42c1b27545e18743fcf8140683fc14f68fd50d9ec8366c2e8391411af255
7
- data.tar.gz: 05824aee6fe7d36c161e8e6be6d172e35ddfd978f402338d8ea723327ba2c874a316aa90a0c5f6bf3afcf85995191f6f750051ef01a73e38032911c852ccc053
6
+ metadata.gz: e6f63feee5b39a00329781d13d47787436b35e43364dbddc5b4a98206985b8afb997cf93fe60326d4d84396da7dcc7217a3af3cea7192799cf10dcfeeaa878a6
7
+ data.tar.gz: fe8021d4c870d0b4bd4c41ce66ba7cbbb4960c1151abd352f80046f441089223b34b7ffce533c44983f4cf7e0a924d2c5029c976b0153147554830e4b541520c
@@ -15,6 +15,18 @@ class AnotherPlace < Sinatra::Base
15
15
  headers({"Content-Type" => "application/json"})
16
16
  end
17
17
 
18
+ # set up a special 404 not found message
19
+ not_found do
20
+ status 404
21
+ body("You're route (HTTP verb and path) didn't get you where you wanted to be...")
22
+ end
23
+
24
+ # create a special error handler
25
+ class CustomClueError < Exception; end
26
+ error CustomClueError do
27
+ "Read your errors!\n" + env['sinatra.error'].message
28
+ end
29
+
18
30
  get '/' do
19
31
  status 200
20
32
  body("::psst:: *check the headers, watch the logs...*\n")
@@ -116,10 +128,8 @@ class AnotherPlace < Sinatra::Base
116
128
 
117
129
  get '/police' do
118
130
  # STEP 9.2
119
- logger.info(Evidence::CLUES[request.path][1][:log_clue])
120
- headers({
121
- "X-Clue" => Evidence::CLUES[request.path][1][:header_clue]
122
- })
131
+ logger.info(Evidence::CLUES[request.path][1][:header_clue])
132
+ raise CustomClueError, Evidence::CLUES[request.path][1][:log_clue]
123
133
  end
124
134
 
125
135
  get '/another_place' do
@@ -89,7 +89,7 @@ EOF
89
89
  body_clue: ""
90
90
  },
91
91
  {
92
- header_clue: "They don't believe us. Or they don't want to know the truth.",
92
+ header_clue: "Read your errors!",
93
93
  log_clue: "We have to go to /another_place",
94
94
  body_clue: ""
95
95
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: another_place
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - phlco