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

[WIP] Fix the Error type #685

Closed
wants to merge 8 commits into from
Closed

[WIP] Fix the Error type #685

wants to merge 8 commits into from

Conversation

D4N
Copy link
Member

@D4N D4N commented Feb 6, 2019

This is another huge PR, but it essentially does only a single thing: remove the templating of BasicError<charT> and replace this class with Error, which is no longer generic. I used this opportunity to convert the ErrorCodes enum to an enumeration class, deprecate AnyError (which is now completely pointless) and optimize the creation of the error messages a little bit (there is still room for improvement though).

This PR is not yet ready, it should be merged into master after #617 is forward ported and we have at least some form of MinGW CI set up (see #645 and #663). Also we have to enable unicode paths on Appveyor before merging this.

@codecov
Copy link

codecov bot commented Feb 6, 2019

Codecov Report

Merging #685 into master will increase coverage by <.01%.
The diff coverage is 31.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #685      +/-   ##
==========================================
+ Coverage   71.18%   71.19%   +<.01%     
==========================================
  Files         148      149       +1     
  Lines       19370    19373       +3     
==========================================
+ Hits        13789    13793       +4     
+ Misses       5581     5580       -1
Impacted Files Coverage Δ
src/futils.cpp 87.62% <ø> (ø) ⬆️
src/gifimage.cpp 43.24% <0%> (ø) ⬆️
samples/exifdata-test.cpp 94.04% <0%> (ø) ⬆️
src/bmpimage.cpp 38.23% <0%> (ø) ⬆️
src/crwimage.cpp 47.82% <0%> (ø) ⬆️
src/tgaimage.cpp 44.73% <0%> (ø) ⬆️
samples/easyaccess-test.cpp 81.25% <0%> (ø) ⬆️
samples/metacopy.cpp 48.88% <0%> (ø) ⬆️
samples/iptctest.cpp 75% <0%> (ø) ⬆️
src/cr2image.cpp 19.44% <0%> (ø) ⬆️
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ce5746...42c320d. Read the comment docs.

@clanmills
Copy link
Collaborator

Thanks for dealing with this, Dan. Grunt work. I'll leave @piponazo to approve the change. Can you apply this to both 0.27 and master?

@D4N
Copy link
Member Author

D4N commented Feb 6, 2019

Can you apply this to both 0.27 and master?

Not for 0.27, this PR requires C++11. On top of that, this is a quite intrusive change API & ABI wise, so pushing this to 0.27 is not a good idea imho.

@piponazo piponazo self-requested a review February 7, 2019 06:14
@piponazo
Copy link
Collaborator

piponazo commented Feb 7, 2019

I took a look to the changes and I like the simplification of things 👍 .

I also think this should only reach master. It is also a big change, and there is always a risk of breaking something without noticing ...

Let me know when you are done with the changes to take another look .

@D4N
Copy link
Member Author

D4N commented Feb 11, 2019

Please do not merge this! This PR must not be merged before we have enabled unicode paths on Windows & MinGW.

@D4N
Copy link
Member Author

D4N commented Mar 21, 2019

@tbeu or @piponazo: Could one of you provide me with the byte contents of a unicode windows path string (preferably with some non-ascii characters)? I'd like to add unit tests to wStr2Utf8 with realistic input.

@clanmills
Copy link
Collaborator

I'm setting the target to 0.28 and the code from this PR should NOT be considered for porting to v0.27 as this would inflict substantial changes to the 0.27 API.

We shouldn't consider this matter related to #947 nor #644. I'm going to search for a solution to #947 and #646 in 0.27-maintenance and I don't expect the fix to be needed in 0.28.

I'll be happy to work with @D4N to resolve issues on Windows to remove the template declarations in error.hpp.

@piponazo
Copy link
Collaborator

Ey @D4N , I see that know the builds are passing in all the CI builders. What's the plan about this PR ?

piponazo
piponazo previously approved these changes Jul 21, 2019
@@ -481,47 +482,47 @@ namespace Exiv2 {
if (hFd == INVALID_HANDLE_VALUE) {
#ifdef EXV_UNICODE_PATH
if (p_->wpMode_ == Impl::wpUnicode) {
throw WError(kerCallFailed, wpath(), "MSG1", "_get_osfhandle");
throw Error(ErrorCode::kerCallFailed, ws2s(wpath()), "MSG1", "_get_osfhandle");
Copy link
Collaborator

Choose a reason for hiding this comment

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

In basicio.cpp I really dislike all the code duplication we have to throw an exception with either wpath() or path(). I would remove the path argument from this call so that we can remove lot of code from this file.

In my opinion is not very useful to incluse the file path in the exception, since we normally use the exiv2 command line tool just with one file (and therefore we know which file is being used) if that exception is thrown.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't like this either, although I'm mostly annoyed by the need to explicitly call ws2s(foo). That should be possible to remove, but I didn't have the time to code something up yet.

@D4N
Copy link
Member Author

D4N commented Jul 23, 2019

Ey @D4N , I see that know the builds are passing in all the CI builders. What's the plan about this PR ?

The following:

  • reorder the commits into a more logical order
  • split the (currently) first commit into two as it contains two distinct changes
  • address your comment

@tbeu
Copy link
Member

tbeu commented Aug 10, 2020

@D4N The conflicts are massive, especially basicio.cpp, after haveing thi PR open for more than one year. Any chances to progress?

Base automatically changed from master to old-master February 28, 2021 05:57
@piponazo
Copy link
Collaborator

I am closing this PR since we already merged the proposed changes in #2141

@piponazo piponazo closed this Mar 14, 2022
@piponazo piponazo deleted the fix_error_type branch March 14, 2022 09:53
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

4 participants