Permalink
Browse files

save exceptions with Never Forget

  • Loading branch information...
1 parent acbe845 commit 0d0108bd1407dd0d1b6686490f769f362e74896e @mislav committed Sep 28, 2011
Showing with 20 additions and 9 deletions.
  1. +1 −0 Gemfile
  2. +14 −8 Gemfile.lock
  3. +5 −1 app.rb
View
@@ -24,3 +24,4 @@ gem 'faraday-stack' #, :path => '/Users/mislav/Projects/faraday-stack'
gem 'choices'
gem 'addressable'
gem 'rake'
+gem 'never-forget'
View
@@ -8,15 +8,16 @@ GEM
activesupport (3.0.5)
addressable (2.2.6)
archive-tar-minitar (0.5.2)
- bson (1.2.4)
- bson_ext (1.2.4)
+ bson (1.4.0)
+ bson_ext (1.4.0)
builder (2.1.2)
choices (0.2.4)
hashie (>= 0.4.0)
columnize (0.3.2)
compass (0.10.6)
haml (>= 3.0.4)
daemons (1.1.2)
+ erubis (2.7.0)
eventmachine (0.12.10)
faraday (0.7.4)
addressable (~> 2.2.6)
@@ -25,21 +26,25 @@ GEM
faraday-stack (0.1.3)
faraday (~> 0.6)
haml (3.0.25)
- hashie (1.0.0)
+ hashie (1.1.0)
i18n (0.5.0)
indextank (1.0.12)
faraday-stack
yajl-ruby (>= 0.7.7)
linecache (0.43)
linecache19 (0.5.11)
ruby_core_source (>= 0.1.4)
- mingo (0.1.5)
- hashie (>= 0.4.0)
- mongo (>= 1.0)
- mongo (1.2.4)
- bson (>= 1.2.4)
+ mingo (0.4.2)
+ mongo (>= 1.3)
+ mongo (1.4.0)
+ bson (= 1.4.0)
mongo_ext (0.19.3)
multipart-post (1.1.2)
+ never-forget (0.1.0)
+ activesupport
+ erubis
+ mingo (>= 0.2)
+ rack
rack (1.3.0)
rake (0.9.2)
ruby-debug (0.10.4)
@@ -87,6 +92,7 @@ DEPENDENCIES
indextank
mingo
mongo_ext
+ never-forget
rake
ruby-debug
ruby-debug19
View
6 app.rb
@@ -1,5 +1,6 @@
# encoding: utf-8
require 'sinatra'
+require 'never_forget'
require 'instagram'
require 'active_support/core_ext/object/blank'
require 'active_support/notifications'
@@ -161,7 +162,7 @@ def last_modified_from_photos(photos)
end
error do
- # err = env['sinatra.error']
+ log_error env['sinatra.error']
status 500
haml "%h1 Error: can't perform this operation\n%p Please, try again later."
end
@@ -197,6 +198,7 @@ def last_modified_from_photos(photos)
redirect Instagram::authorization_url(return_to: return_url).to_s
end
rescue Faraday::Error::ClientError => error
+ log_error error
status 500
haml "%h1 Instagram error: #{error.response[:body]['error_message']}"
end
@@ -237,6 +239,7 @@ def last_modified_from_photos(photos)
@photos = @user.photos params[:max_id]
@per_page = 20
rescue Faraday::Error::ClientError => e
+ log_error e
message = e.response[:body]['meta']['error_message']
if "this user does not exist" == message
@@ -313,6 +316,7 @@ def last_modified_from_photos(photos)
"%p <strong>Note:</strong> you <em>must</em> have a profile picture on Instagram."
end
rescue
+ log_error
raise unless settings.production?
status 500
haml "%h1 Error\n%p The user ID couldn't be discovered because of an error"

0 comments on commit 0d0108b

Please sign in to comment.