Skip to content

Commit

Permalink
Display error message if lookup fails #264
Browse files Browse the repository at this point in the history
  • Loading branch information
oneiros committed Mar 1, 2024
1 parent 4716c0c commit 9d13669
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/lookups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ class LookupsController < ApplicationController

def show
@result = @key.lookup(@node)
rescue Hdm::Error => error
@error = error

render action: "error"
end

private
Expand Down
5 changes: 5 additions & 0 deletions app/views/lookups/error.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%= turbo_frame_tag "lookup-result-frame" do %>
<p class="alert alert-danger">
<%= @error.message %>
</p>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ hdm_nested_hash:
nested_hash:
integer: 32
added_by_common: common
hdm_mixed_types: 42
lookup_options:
'^hdm_duplicates':
merge: hash
Expand All @@ -26,4 +27,6 @@ lookup_options:
hash_syntax:
merge:
strategy: deep
hdm_mixed_types:
merge: deep

Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ hdm_nested_hash:
origin: node
nested_hash:
integer: 5
hdm_mixed_types:
from_node: 23

0 comments on commit 9d13669

Please sign in to comment.