lib/backend_sgx.rb 🔗
@@ -9,6 +9,8 @@ require_relative "not_loaded"
require_relative "form_to_h"
class BackendSgx
+ class CanceledError < StandardError; end
+
using FormToH
value_semantics do
Amolith and Crush created
References: https://todo.sr.ht/~singpolyma/soprani.ca/380
Co-Authored-By: Crush <crush@charm.land>
lib/backend_sgx.rb | 2 ++
sgx_jmp.rb | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
@@ -9,6 +9,8 @@ require_relative "not_loaded"
require_relative "form_to_h"
class BackendSgx
+ class CanceledError < StandardError; end
+
using FormToH
value_semantics do
@@ -898,8 +898,10 @@ Command.new(
raise "PIN and confirm PIN must match." unless pin == confirm_pin
customer.set_port_out_pin(pin)
- }.then do
+ }.then {
Command.finish("Your port-out PIN has been set.")
+ }.catch_only(BackendSgx::CanceledError) do |e|
+ Command.finish(e.message, status: :canceled)
end
end
}.register(self).then(&CommandList.method(:register))