Treat already-set PIN err as success

Amolith created

Change summary

lib/bandwidth_tn_options.rb | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Detailed changes

lib/bandwidth_tn_options.rb 🔗

@@ -75,7 +75,14 @@ class BandwidthTNOptions
 		end
 
 		EMPromise.resolve(nil).then do
-			order = BandwidthIris::TnOptions.get_tn_option_order(client, order_id)
+			begin
+				order = BandwidthIris::TnOptions.get_tn_option_order(client, order_id)
+			rescue BandwidthIris::Errors::GenericError => e
+				raise unless e.code == 5195 # Same PIN already set
+
+				# So treat as success
+				next true
+			end
 
 			warnings = order[:warnings]
 			if warnings&.any?