mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Improve error messaging for fetching packages
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
class W3DHub
|
class W3DHub
|
||||||
class Api
|
class Api
|
||||||
class Package
|
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
|
:custom_partially_valid_at_bytes, :custom_is_patch
|
||||||
|
|
||||||
def initialize(hash)
|
def initialize(hash)
|
||||||
@@ -16,6 +16,7 @@ class W3DHub
|
|||||||
@checksum = @data[:checksum]
|
@checksum = @data[:checksum]
|
||||||
@checksum_chunk_size = @data[:"checksum-chunk-size"]
|
@checksum_chunk_size = @data[:"checksum-chunk-size"]
|
||||||
@checksum_chunks = @data[:"checksum-chunks"]
|
@checksum_chunks = @data[:"checksum-chunks"]
|
||||||
|
@error = @data[:error] || nil
|
||||||
|
|
||||||
@custom_partially_valid_at_bytes = 0
|
@custom_partially_valid_at_bytes = 0
|
||||||
@custom_is_patch = false
|
@custom_is_patch = false
|
||||||
@@ -25,6 +26,10 @@ class W3DHub
|
|||||||
@checksum_chunks[:"#{key}"]
|
@checksum_chunks[:"#{key}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def error?
|
||||||
|
@error
|
||||||
|
end
|
||||||
|
|
||||||
def partially_valid_at_bytes=(i)
|
def partially_valid_at_bytes=(i)
|
||||||
@custom_partially_valid_at_bytes = i
|
@custom_partially_valid_at_bytes = i
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class W3DHub
|
|||||||
@task_state = :complete unless @task_state == :failed
|
@task_state = :complete unless @task_state == :failed
|
||||||
|
|
||||||
hide_application_taskbar if @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
|
end
|
||||||
end
|
end
|
||||||
@@ -370,6 +370,11 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
[package_details].flatten.each do |rich|
|
[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|
|
package = @packages.find do |pkg|
|
||||||
pkg.category == rich.category &&
|
pkg.category == rich.category &&
|
||||||
pkg.subcategory == rich.subcategory &&
|
pkg.subcategory == rich.subcategory &&
|
||||||
@@ -572,7 +577,12 @@ class W3DHub
|
|||||||
if array.is_a?(Array)
|
if array.is_a?(Array)
|
||||||
package = array.first
|
package = array.first
|
||||||
else
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -605,7 +615,7 @@ class W3DHub
|
|||||||
return false unless File.exist?(path)
|
return false unless File.exist?(path)
|
||||||
|
|
||||||
operation = @status.operations[:"#{package.checksum}"]
|
operation = @status.operations[:"#{package.checksum}"]
|
||||||
operation&.value = "Verifying..."
|
operation&.value = "Verifying..."
|
||||||
|
|
||||||
file_size = File.size(path)
|
file_size = File.size(path)
|
||||||
logger.info(LOG_TAG) { " File size: #{file_size}" }
|
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
|
@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
|
stack(width: 1.0, height: 1.0, margin_left: 16, margin_right: 16) do
|
||||||
flow(width: 1.0, height: 0.65) do
|
flow(width: 1.0, height: 0.65) do
|
||||||
@application_taskbar_label = para "", width: 0.60, text_wrap: :none
|
@application_taskbar_label = para "", fill: true, text_wrap: :none
|
||||||
@application_taskbar_status_label = para "", width: 0.40, text_align: :right, text_wrap: :none
|
@application_taskbar_status_label = para "", min_width: 0.40, text_align: :right, text_wrap: :none
|
||||||
end
|
end
|
||||||
|
|
||||||
@application_taskbar_progressbar = progress fraction: 0.0, height: 2, width: 1.0
|
@application_taskbar_progressbar = progress fraction: 0.0, height: 2, width: 1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user