diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-03-02 23:30:31 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-03-06 21:43:20 +0900 |
commit | 7bbd5f6e31036a9ab6305b14eedbad25c5501648 (patch) | |
tree | 2b8c992c83b2761339a63f01a2ab7562143000cc /lib | |
parent | 481d0bc3db1c83fe50d6e1441d0d13aa227a757b (diff) | |
download | gitlab-ce-7bbd5f6e31036a9ab6305b14eedbad25c5501648.tar.gz |
Define Trace::ArchiveError to make it explit as an error
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/trace.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb index 256cd2c5e4a..c5356af2f02 100644 --- a/lib/gitlab/ci/trace.rb +++ b/lib/gitlab/ci/trace.rb @@ -1,6 +1,8 @@ module Gitlab module Ci class Trace + ArchiveError = Class.new(StandardError) + attr_reader :job delegate :old_trace, to: :job @@ -94,8 +96,8 @@ module Gitlab end def archive! - raise 'Already archived' if trace_artifact - raise 'Job is not finished yet' unless job.complete? + raise ArchiveError, 'Already archived' if trace_artifact + raise ArchiveError, 'Job is not finished yet' unless job.complete? if current_path File.open(current_path) do |stream| @@ -124,7 +126,7 @@ module Gitlab temp_path = File.join(dir_path, "job.log") FileUtils.touch(temp_path) size = IO.copy_stream(src_stream, temp_path) - raise 'Not all saved' unless size == src_stream.size + raise ArchiveError, 'Failed to copy stream' unless size == src_stream.size yield(temp_path) end |