Better CNAM fail error message

Stephen Paul Weber created

Change summary

lib/customer_repo.rb | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Detailed changes

lib/customer_repo.rb 🔗

@@ -73,6 +73,8 @@ class CustomerRepo
 				use_type: "RESIDENTIAL", visibility: "PUBLIC"
 			} }
 		)
+	rescue BandwidthIris::Errors::GenericError
+		raise "Could not set CNAM, please contact support"
 	end
 
 	def put_transcription_enabled(customer, transcription_enabled)
@@ -82,9 +84,8 @@ class CustomerRepo
 	end
 
 	def put_fwd(customer, customer_fwd)
-		@sgx_repo.put_fwd(
-			customer.customer_id, customer.registered?.phone, customer_fwd
-		)
+		tel = customer.registered?.phone
+		@sgx_repo.put_fwd(customer.customer_id, tel, customer_fwd)
 	end
 
 protected
@@ -121,8 +122,7 @@ protected
 		result = @db.query_defer(SQL, [customer_id])
 		EMPromise.all([@sgx_repo.get(customer_id), result]).then do |(sgx, rows)|
 			data = hydrate_plan(
-				customer_id,
-				rows.first&.transform_keys(&:to_sym) || {}
+				customer_id, rows.first&.transform_keys(&:to_sym) || {}
 			)
 			Customer.new(customer_id, Blather::JID.new(jid), sgx: sgx, **data)
 		end