Skip to content

Commit

Permalink
Exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
paresharma committed Mar 25, 2015
1 parent 3fe482d commit b9512c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/scorm_rte.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'scorm_rte/engine'
require 'scorm_rte/errors'
require 'scorm_rte/lms/sco'
require 'scorm_rte/lms/controllers/helpers'

Expand Down
3 changes: 3 additions & 0 deletions lib/scorm_rte/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ class ScormRteError < StandardError
end

class NoScoInstanceIdError < ScormRteError
def message
'Always provide a unique SCO intance ID'
end
end
end
4 changes: 2 additions & 2 deletions lib/scorm_rte/lms/sco.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module ScormRte
module Lms
class Sco
def initialize(sco_instance_id: nil)
unless sco_instance_id
fail NoScoInstanceIdError, 'Always provide a unique SCO intance ID'
unless sco_instance_id.present?
fail NoScoInstanceIdError
end
@sco_instance_id = sco_instance_id
end
Expand Down

0 comments on commit b9512c9

Please sign in to comment.