electron/rcedit

ScopedResourceUpdater::EndUpdate and ResourceUpdater::GetResourcePointer don't expose the error

jguze opened this issue · 0 comments

jguze commented

I was getting a pretty generic failure message from rcedit, and I had no error object to look into further. Looking at the code, there's two places in rescle.cc that call GetLastError, but don't expose or throw the error.

ScopedResourceUpdater::EndUpdate:

bool ScopedResourceUpdater::EndUpdate(const bool& doesCommit) {
  BOOL fDiscard = doesCommit ? FALSE : TRUE;
  BOOL bResult = EndUpdateResourceW(handle, fDiscard);
  DWORD e = GetLastError();
  return bResult ? true : false;
}

ResourceUpdater::GetResourcePointer

...
  HRSRC hRsrc = FindResourceExW(hModule, type, MAKEINTRESOURCEW(id), languageId);
  if (hRsrc == NULL) {
    DWORD e = GetLastError();
    return false;
  }
...

I wasn't sure if there might be reason we shouldn't just throw the error in these cases.