Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filename to error message #151

Merged
merged 2 commits into from
Apr 11, 2017

Conversation

val99erie
Copy link
Contributor

Because I'm submitting 2 PRs in a row against the same branch, the diff for this PR will also include the changes for PR #150 until PR #150 gets merged.

The true diff for this PR is quite small. You can see it here:
cancelled_status...add_filename_to_error_message

Please merge PR #150 before this one. Thanks!

end

def raise_exception_if_encoding_failed(encode)
return unless encode.failed?
raise StandardError.new("Encoding failed: #{encode.errors.join(' ; ')}")
raise StandardError.new("Encoding failed for #{source_path}: #{encode.errors.join(' ; ')}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is a good opportunity to create our own subclasses of StandardError (or, maybe RuntimeError) to carry this information consistently and in a machine-readable way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbeer Do you mean: keep the same error message, but just give the error class a more distinct name (such as EncodingCancelled)? Or do you mean that the error class should have more info than just the error message?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this would benefit from our own subclass of exception, and that subclass can take the source path as an argument (something like:

class EncodingException < RuntimeError
  def initialize(source_path, message)
    ...
  end
end

) and use that both to build the message, but also provide the callers with something they could reasonably expect to handle.

@coveralls
Copy link

coveralls commented Apr 11, 2017

Coverage Status

Changes Unknown when pulling 23d79e9 on add_filename_to_error_message into ** on active_encode_dev_con**.

@val99erie val99erie force-pushed the add_filename_to_error_message branch from 23d79e9 to 37c4991 Compare April 11, 2017 18:39
@val99erie
Copy link
Contributor Author

I rebased to get those rubocop changes

@coveralls
Copy link

coveralls commented Apr 11, 2017

Coverage Status

Coverage decreased (-0.06%) to 84.486% when pulling 37c4991 on add_filename_to_error_message into a831f7c on active_encode_dev_con.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 84.486% when pulling 37c4991 on add_filename_to_error_message into a831f7c on active_encode_dev_con.

# while(encode.reload.running?) { sleep 10 }

raise_exception_if_encoding_failed(encode)
raise_exception_if_encoding_cancelled(encode)
raise ActiveEncodeError.new(encode.state, source_path, encode.errors) unless encode.completed?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this always throw an error since we're not blocking until the job is finished yet? Seems like it will always have a status of :running when it gets to this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, that encoding on line 14 can never work. That isn't the correct method signature, is it? I have code on my other branch that creates the encode differently and waits for it to finish running.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is okay, but maybe we can just forget about that point right now. Assuming the encode job is blocking then I think the unless completed check is correct.

@val99erie
Copy link
Contributor Author

I don't know what to do to make the coveralls build pass.

@mjgiarlo
Copy link
Member

@val99erie I changed the coveralls config for this repo to only fail is the coverage decrease threshold exceeds 0.3%, which is a value we use elsewhere in Hydralandia.

@mjgiarlo mjgiarlo merged commit a0f828e into active_encode_dev_con Apr 11, 2017
@mjgiarlo mjgiarlo deleted the add_filename_to_error_message branch April 11, 2017 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants