codersdojo 1.5.09 → 1.5.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/codersdojo.rb +18 -0
  2. data/lib/console_view.rb +9 -0
  3. metadata +3 -3
data/lib/codersdojo.rb CHANGED
@@ -4,6 +4,7 @@ require 'shellutils/argument_parser'
4
4
  require 'console_view'
5
5
  require 'commands/command_configuration'
6
6
  require 'scaffold/scaffolder'
7
+ require 'rest_client'
7
8
 
8
9
  class CodersDojo
9
10
 
@@ -11,6 +12,21 @@ class CodersDojo
11
12
  @params = params
12
13
  @hostname = hostname
13
14
  end
15
+
16
+ def handle_internal_server_error view, exception
17
+ log_file_name = 'error.log'
18
+ File.open(log_file_name, 'w') do |f|
19
+ f.puts "### Error ###"
20
+ f.puts exception.message
21
+ f.puts
22
+ f.puts "### Client backtrace ###"
23
+ f.puts exception.backtrace
24
+ f.puts
25
+ f.puts "### HTTP Body ###"
26
+ f.puts exception.http_body
27
+ end
28
+ view.show_internal_server_error exception, log_file_name
29
+ end
14
30
 
15
31
  def run
16
32
  if called_from_spec? then return end
@@ -26,6 +42,8 @@ class CodersDojo
26
42
  view.show_unknwon_command_message e.command
27
43
  rescue PropertyFileMissingException => e
28
44
  view.show_properties_file_missing_error e.filename
45
+ rescue RestClient::InternalServerError => e
46
+ handle_internal_server_error view, e
29
47
  end
30
48
  end
31
49
 
data/lib/console_view.rb CHANGED
@@ -215,6 +215,15 @@ msg
215
215
  Property file #{filename} is missing.
216
216
  Maybe you created the directory structure with an older version of CodersDojo?
217
217
  Recreate the directory structure with the current version with 'codersdojo setup ...'.
218
+ msg
219
+ end
220
+
221
+ def show_internal_server_error exception, log_file_name
222
+ show <<-msg
223
+ !!! WTF?
224
+ !!! An internal server error occurred. This probably means that we sucked and there is
225
+ !!! a bug. An error log was written to #{log_file_name}.
226
+ !!! Please help us to fix the bug and send us the log file via email: codersdojo@it-agile.de
218
227
  msg
219
228
  end
220
229
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 9
9
- version: 1.5.09
8
+ - 10
9
+ version: 1.5.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - CodersDojo-Team
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-11-01 00:00:00 +01:00
17
+ date: 2012-01-05 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency