From: František Dvořák Date: Tue, 14 Jun 2016 12:26:20 +0000 (+0200) Subject: Ruby: better way of using of the exeptions (message variable already there). X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=d6e63263a52eb16aaa86bbbe36a5ec60c1ac8e49;p=now.git Ruby: better way of using of the exeptions (message variable already there). --- diff --git a/.rubocop.yml b/.rubocop.yml index 1ec3868..7378663 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -74,11 +74,6 @@ Style/MutableConstant: Style/NegatedIf: Enabled: false -# Provide an exception class and message as arguments to raise -# (wtf) -Style/RaiseArgs: - Enabled: false - # Redundant return detected # (easy to read) Style/RedundantReturn: diff --git a/lib/error.rb b/lib/error.rb index 219b5ae..4f24575 100644 --- a/lib/error.rb +++ b/lib/error.rb @@ -2,11 +2,10 @@ module Now # The main exception class for NOW. class NowError < StandardError - attr_accessor :code, :message + attr_accessor :code - def initialize(code, message) + def initialize(code) @code = code - @message = message end end diff --git a/lib/nebula.rb b/lib/nebula.rb index 4c2c1cb..6419da8 100644 --- a/lib/nebula.rb +++ b/lib/nebula.rb @@ -129,7 +129,7 @@ module Now end code = error_one2http(return_code.errno) - raise NowError.new(code, return_code.message) + raise NowError.new(code), return_code.message end end