mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-15 16:52:34 +00:00
Improve error messaging for fetching packages
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class W3DHub
|
||||
class Api
|
||||
class Package
|
||||
attr_reader :category, :subcategory, :name, :version, :size, :checksum, :checksum_chunk_size, :checksum_chunks,
|
||||
attr_reader :category, :subcategory, :name, :version, :size, :checksum, :checksum_chunk_size, :checksum_chunks, :error,
|
||||
:custom_partially_valid_at_bytes, :custom_is_patch
|
||||
|
||||
def initialize(hash)
|
||||
@@ -16,6 +16,7 @@ class W3DHub
|
||||
@checksum = @data[:checksum]
|
||||
@checksum_chunk_size = @data[:"checksum-chunk-size"]
|
||||
@checksum_chunks = @data[:"checksum-chunks"]
|
||||
@error = @data[:error] || nil
|
||||
|
||||
@custom_partially_valid_at_bytes = 0
|
||||
@custom_is_patch = false
|
||||
@@ -25,6 +26,10 @@ class W3DHub
|
||||
@checksum_chunks[:"#{key}"]
|
||||
end
|
||||
|
||||
def error?
|
||||
@error
|
||||
end
|
||||
|
||||
def partially_valid_at_bytes=(i)
|
||||
@custom_partially_valid_at_bytes = i
|
||||
end
|
||||
|
||||
@@ -78,7 +78,7 @@ class W3DHub
|
||||
@task_state = :complete unless @task_state == :failed
|
||||
|
||||
hide_application_taskbar if @task_state == :failed
|
||||
send_message_dialog(:failure, "Task #{type.inspect} failed for #{@application.name}", @task_failure_reason) if @task_state == :failed && !@fail_silently
|
||||
send_message_dialog(:failure, "#{type.to_s.capitalize} Task failed for #{@application.name}", @task_failure_reason) if @task_state == :failed && !@fail_silently
|
||||
# end
|
||||
end
|
||||
end
|
||||
@@ -370,6 +370,11 @@ class W3DHub
|
||||
end
|
||||
|
||||
[package_details].flatten.each do |rich|
|
||||
if rich.error?
|
||||
fail!("Failed to retrieve package details! (#{rich.category}:#{rich.subcategory}:#{rich.name}:#{rich.version})\nError: #{rich.error.gsub("-", " ").capitalize}")
|
||||
return
|
||||
end
|
||||
|
||||
package = @packages.find do |pkg|
|
||||
pkg.category == rich.category &&
|
||||
pkg.subcategory == rich.subcategory &&
|
||||
@@ -572,7 +577,12 @@ class W3DHub
|
||||
if array.is_a?(Array)
|
||||
package = array.first
|
||||
else
|
||||
fail!("Failed to fetch manifest package details!")
|
||||
fail!("Failed to fetch manifest package details! (#{category}:#{subcategory}:#{name}:#{version})")
|
||||
return
|
||||
end
|
||||
|
||||
if package.error?
|
||||
fail!("Failed to retrieve manifest package details! (#{category}:#{subcategory}:#{name}:#{version})\nError: #{package.error.gsub("-", " ").capitalize}")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -605,7 +615,7 @@ class W3DHub
|
||||
return false unless File.exist?(path)
|
||||
|
||||
operation = @status.operations[:"#{package.checksum}"]
|
||||
operation&.value = "Verifying..."
|
||||
operation&.value = "Verifying..."
|
||||
|
||||
file_size = File.size(path)
|
||||
logger.info(LOG_TAG) { " File size: #{file_size}" }
|
||||
|
||||
@@ -70,8 +70,8 @@ class W3DHub
|
||||
@application_taskbar_container = flow(width: 1.0, height: 0.5) do
|
||||
stack(width: 1.0, height: 1.0, margin_left: 16, margin_right: 16) do
|
||||
flow(width: 1.0, height: 0.65) do
|
||||
@application_taskbar_label = para "", width: 0.60, text_wrap: :none
|
||||
@application_taskbar_status_label = para "", width: 0.40, text_align: :right, text_wrap: :none
|
||||
@application_taskbar_label = para "", fill: true, text_wrap: :none
|
||||
@application_taskbar_status_label = para "", min_width: 0.40, text_align: :right, text_wrap: :none
|
||||
end
|
||||
|
||||
@application_taskbar_progressbar = progress fraction: 0.0, height: 2, width: 1.0
|
||||
|
||||
Reference in New Issue
Block a user