Skip to content

Commit

Permalink
fix: error regression
Browse files Browse the repository at this point in the history
  • Loading branch information
diegosteiner committed Nov 6, 2024
1 parent e04b0ae commit 310ded0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions app/domain/booking_actions/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module BookingActions
class Base
class NotAllowed < StandardError; end
Result = Struct.new(:success, :redirect_proc, :error, keyword_init: true) do
def self.success(**)
new(success: true, **)
Expand Down Expand Up @@ -35,10 +36,14 @@ def self.label
end

def invoke(...)
# i18n-tasks-ignore
return Result.failure error: translate(:not_allowed) unless allowed?
raise NotAllowed unless allowed?

invoke!(...)
rescue Statesman::TransitionConflictError, NotAllowed
# i18n-tasks-ignore
Result.failure error: translate(:not_allowed)
rescue StandardError => e
Result.failure error: e.message
end

def self.to_sym
Expand Down
2 changes: 1 addition & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ de:
home_id: Hauptmietobjekt
ignore_conflicting: Terminkonflikte ignorieren
internal_remarks: Interne Bemerkungen
invoice_address: Rechnungsadresse (falls abweichend)
invoice_address: vollständige Rechnungsadresse (falls abweichend)
locale: Sprache
nights: Nächte
notifications_enabled: Aus der Applikation generierte Emails versenden
Expand Down

0 comments on commit 310ded0

Please sign in to comment.