Opened 5 years ago

Last modified 4 years ago

#1060 new change

Use system_error mechanism

Reported by: sergz Assignee:
Priority: P4 Milestone:
Module: Adblock-Plus-for-Internet-Explorer Keywords:
Cc: Blocked By:
Blocking: Platform: Internet Explorer
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

Description

Background

In the project there are several domains of the runtime errors, at least

  • from std classes
  • based on Windows API GetLastError()
  • our own domain, unexpected value of some input arguments, or some state is inconsistent, like pipe became closed, which is basically should be GetLastError()

Fortunately, now there is a standard way to handle different errors uniformly.

What to change

First of all we should fix the usage of GetLastError(). GetLastError() should be called before anything else. At least now we are creating some strings which involves memory allocation, which can modify the result of GetLastError().

We have to have custom error_category (C++11) for GetLastError(). Since we are not going to create the insane enum for all Windows error codes and properly implement the equivalence, so only implement partially (name, message (based on FormatMessage)) error_category and the factory method (which should not be available using ADL, something like std::error_code makeWinErrorCode(int code);).

Change History (2)

comment:1 Changed 5 years ago by sergz

  • Component changed from Unknown to Adblock-Plus-for-Internet-Explorer
  • Priority changed from Unknown to P4

comment:2 Changed 4 years ago by oleksandr

  • Ready set
Note: See TracTickets for help on using tickets.