Skip to content

Commit

Permalink
Rename fault name to type
Browse files Browse the repository at this point in the history
  • Loading branch information
drexed committed Sep 30, 2024
1 parent 390ad9b commit fab3c6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Simplify error building
- Reduced recalling error since we can just throw it once
- Rename `fault_name` to `type`

## [2.0.2] - 2024-09-29
### Added
Expand Down
8 changes: 2 additions & 6 deletions lib/lite/command/fault.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ def initialize(reason, caused_by, thrown_by)
@thrown_by = thrown_by
end

def fault_klass
@fault_klass ||= self.class.name.split("::").last
end

def fault_name
@fault_name ||= fault_klass.downcase
def type
@type ||= self.class.name.split("::").last.downcase
end

end
Expand Down
6 changes: 3 additions & 3 deletions lib/lite/command/internals/executable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module Executable
def execute
around_execution { call }
rescue StandardError => e
fn = e.respond_to?(:fault_name) ? e.fault_name : ERROR
f = e.respond_to?(:type) ? e.type : ERROR

send(:"#{fn}", e)
send(:"#{f}", e)
after_execution
send(:"on_#{fn}", e)
send(:"on_#{f}", e)
end

def execute!
Expand Down

0 comments on commit fab3c6b

Please sign in to comment.