improve Column not found error message
This commit is contained in:
parent
3e73ff0d35
commit
4e0d3c2df1
2 changed files with 8 additions and 2 deletions
|
@ -38,6 +38,12 @@ class Column
|
|||
end
|
||||
|
||||
def self.find(h_id)
|
||||
Procedure.with_discarded.find(h_id[:procedure_id]).find_column(h_id:)
|
||||
begin
|
||||
procedure = Procedure.with_discarded.find(h_id[:procedure_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
raise ActiveRecord::RecordNotFound.new("Column: unable to find procedure #{h_id[:procedure_id]} from h_id #{h_id}")
|
||||
end
|
||||
|
||||
procedure.find_column(h_id: h_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module ColumnsConcern
|
|||
column = columns.find { _1.h_id == h_id } if h_id.present?
|
||||
column = columns.find { _1.label == label } if label.present?
|
||||
|
||||
raise ActiveRecord::RecordNotFound if column.nil?
|
||||
raise ActiveRecord::RecordNotFound.new("Column: unable to find h_id: #{h_id} or label: #{label} for procedure_id #{id}") if column.nil?
|
||||
|
||||
column
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue