-
Notifications
You must be signed in to change notification settings - Fork 53
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
[Help wanted] Is it possible to throw specified exception? #322
Comments
Unfortunately, the only kind of exceptions we can throw from C++/WinRT is HRESULT exceptions. We also cannot set any error messages or details. This leaves us with a very limited set of exception options. A few very common things like invalid argument are possible, but not nearly detailed enough to report the actual error situation. We could declare our own HRESULT values. But I think it won't be very helpful, because you'd have to manually lookup which code means which error. Also from ffmpeg side, it is often not easy to find out programmatically what has really gone wrong. Detailed error messages are often only output as log messages. You will find them in debug output of the app, if you are running in debugger. You could also register a log handler, to get the ffmpeg log output into an app's log file, when debugger is not attached (see FFmpegInteropLogging class). |
Actually it looks like we can provide custom exception messages! I only never saw it, because the constructor overloads do not show up on intellisense (WTF)?! This will show an exception with message "Test" in C# Sample: C++/CX also allowed to set custom messages, but they would never show on C# side, so I did not bother using them. Now that this seems to work in C++/WinRT, we could indeed be moving from HRESULT based model to throwing detailed exceptions, especially in the constructor methods. We can also use some of the HRESULT values from mferror.h (MF_E_*). |
It sounds great! Thank you for the detailed explanation. |
FFmpegMediaSource.CreateFromUriAsync
always throws unspecified error if there is something wrong:It might be HTTP 404/403 or something else and it is hard to handle these exceptions.
FFplay reports these detail errors, and I am wondering is it possible for FFmpegInteropX to throw specified errors like FFplay.
The text was updated successfully, but these errors were encountered: