Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Expose Debug macro for hresult_error. Start catching these...",
"packageName": "react-native-windows",
"email": "asklar@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-04-29T10:28:07.247Z"
}
5 changes: 4 additions & 1 deletion vnext/ReactUWP/Views/Image/ReactImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <winrt/Windows.Web.Http.h>

#include "Unicode.h"
#include "cdebug.h"

namespace winrt {
using namespace Windows::Foundation;
Expand Down Expand Up @@ -84,6 +85,7 @@ winrt::Stretch ReactImage::ResizeModeToStretch(react::uwp::ResizeMode value) {
default: // ResizeMode::Center
// This function should never be called for the 'repeat' resizeMode case.
// That is handled by the shouldUseCompositionBrush/switchBrushes code path.
// #4691
assert(value != ResizeMode::Repeat);

if (m_imageSource.height < ActualHeight() && m_imageSource.width < ActualWidth()) {
Expand Down Expand Up @@ -328,7 +330,8 @@ winrt::IAsyncOperation<winrt::InMemoryRandomAccessStream> GetImageStreamAsync(Re

co_return memoryStream;
}
} catch (winrt::hresult_error const &) {
} catch (winrt::hresult_error const &e) {
DEBUG_HRESULT_ERROR(e);
}

co_return nullptr;
Expand Down
5 changes: 5 additions & 0 deletions vnext/include/ReactWindowsCore/cdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ class basic_dostream : public std::basic_ostream<CharT> {

extern basic_dostream<char> cdebug;
extern basic_dostream<wchar_t> cwdebug;

#define DEBUG_HRESULT_ERROR(e) \
cdebug << __FILE__ << " (" << __LINE__ << ") "; \
cdebug.flush(); \
cwdebug << e.message().c_str() << std::endl;