From 310ded093b5fa9a31a8cdc52be21e8dc490d4190 Mon Sep 17 00:00:00 2001 From: Diego Steiner Date: Tue, 29 Oct 2024 15:02:03 +0000 Subject: [PATCH] fix: error regression --- app/domain/booking_actions/base.rb | 9 +++++++-- config/locales/de.yml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/domain/booking_actions/base.rb b/app/domain/booking_actions/base.rb index e157c8d77..b4daf66ed 100644 --- a/app/domain/booking_actions/base.rb +++ b/app/domain/booking_actions/base.rb @@ -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, **) @@ -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 diff --git a/config/locales/de.yml b/config/locales/de.yml index 02d6acf1a..9c65b3e28 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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