chore: swap StandardError/RuntimeError, simplify

Amolith created

Change summary

lib/bandwidth_tn_options.rb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

Detailed changes

lib/bandwidth_tn_options.rb 🔗

@@ -30,7 +30,7 @@ class BandwidthTNOptions
 			order_id = order[:order_id]
 
 			unless order_id
-				raise StandardError.new("Missing OrderId in create response")
+				raise "Missing OrderId in create response"
 			end
 
 			poll_order(order_id, client)
@@ -39,7 +39,7 @@ class BandwidthTNOptions
 
 	def self.poll_order(order_id, client, attempt=1, max_attempts=30)
 		if attempt > max_attempts
-			return EMPromise.reject(StandardError.new(
+			return EMPromise.reject(RuntimeError.new(
 				"TnOptions polling timeout after #{max_attempts} attempts"
 			))
 		end
@@ -51,14 +51,14 @@ class BandwidthTNOptions
 			if error_list&.any?
 				errors = [error_list].flatten
 				msgs = errors.map { |e| e.to_s }.reject(&:empty?).join('; ')
-				raise StandardError.new("Dashboard tnOptions errors: #{msgs}")
+				raise "Dashboard tnOptions errors: #{msgs}"
 			end
 
 			warnings = order[:warnings]
 			if warnings&.any?
 				warns = [warnings].flatten
 				descs = warns.map { |w| w.to_s }.reject(&:empty?).join('; ')
-				raise StandardError.new("Dashboard tnOptions warnings: #{descs}")
+				raise "Dashboard tnOptions warnings: #{descs}"
 			end
 
 			status = order[:order_status] || order[:processing_status]
@@ -67,7 +67,7 @@ class BandwidthTNOptions
 			when 'COMPLETE', 'PARTIAL'
 				true
 			when 'FAILED'
-				raise StandardError.new("TnOptions order failed with status: #{status}")
+				raise "TnOptions order failed with status: #{status}"
 			when 'RECEIVED', 'PROCESSING'
 				EMPromise.new { |resolve, reject|
 					EM.add_timer(2) do
@@ -77,7 +77,7 @@ class BandwidthTNOptions
 					end
 				}
 			else
-				raise StandardError.new("Unexpected poll status: #{status.inspect}")
+				raise "Unexpected poll status: #{status.inspect}"
 			end
 		end
 	end