OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 * When the code has a systematic way of handling bad_alloc, we'll rethrow (
probably). | 50 * When the code has a systematic way of handling bad_alloc, we'll rethrow (
probably). |
51 * Until then, we mask the exception and make no modification. | 51 * Until then, we mask the exception and make no modification. |
52 */ | 52 */ |
53 } | 53 } |
54 catch(...) | 54 catch(...) |
55 { | 55 { |
56 // no modification if any other exception | 56 // no modification if any other exception |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 void LogQueue::LogPluginError(DWORD errorCode, int errorId, int errorSubid, cons
t CString& description, bool isAsync, DWORD dwProcessId, DWORD dwThreadId) | 60 void LogQueue::LogPluginError(DWORD errorCode, int errorId, int errorSubid, cons
t std::string& description, bool isAsync, DWORD dwProcessId, DWORD dwThreadId) |
61 { | 61 { |
62 // Prevent circular references | 62 // Prevent circular references |
63 if (CPluginSettings::HasInstance() && isAsync) | 63 if (CPluginSettings::HasInstance() && isAsync) |
64 { | 64 { |
65 DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId); | 65 DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId); |
66 | 66 |
67 CString pluginError; | 67 CString pluginError; |
68 pluginError.Format(L"%2.2d%2.2d", errorId, errorSubid); | 68 pluginError.Format(L"%2.2d%2.2d", errorId, errorSubid); |
69 | 69 |
70 CString pluginErrorCode; | 70 CString pluginErrorCode; |
71 pluginErrorCode.Format(L"%u", errorCode); | 71 pluginErrorCode.Format(L"%u", errorCode); |
72 | 72 |
73 CPluginSettings* settings = CPluginSettings::GetInstance(); | 73 CPluginSettings* settings = CPluginSettings::GetInstance(); |
74 | 74 |
75 settings->AddError(pluginError, pluginErrorCode); | 75 settings->AddError(pluginError, pluginErrorCode); |
76 } | 76 } |
77 | 77 |
78 // Post error to client for later submittal | 78 // Post error to client for later submittal |
79 if (!isAsync) | 79 if (!isAsync) |
80 { | 80 { |
81 LogQueue::PostPluginError(errorId, errorSubid, errorCode, description); | 81 LogQueue::PostPluginError(errorId, errorSubid, errorCode, description); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 void LogQueue::PostPluginError(int errorId, int errorSubid, DWORD errorCode, con
st CString& errorDescription) | 86 void LogQueue::PostPluginError(int errorId, int errorSubid, DWORD errorCode, con
st std::string& errorDescription) |
87 { | 87 { |
88 s_criticalSectionQueue.Lock(); | 88 s_criticalSectionQueue.Lock(); |
89 { | 89 { |
90 CPluginError pluginError(errorId, errorSubid, errorCode, errorDescription); | 90 CPluginError pluginError(errorId, errorSubid, errorCode, errorDescription); |
91 | 91 |
92 s_pluginErrors.push_back(pluginError); | 92 s_pluginErrors.push_back(pluginError); |
93 } | 93 } |
94 s_criticalSectionQueue.Unlock(); | 94 s_criticalSectionQueue.Unlock(); |
95 } | 95 } |
96 | 96 |
(...skipping 11 matching lines...) Expand all Loading... |
108 | 108 |
109 hasError = true; | 109 hasError = true; |
110 | 110 |
111 s_pluginErrors.erase(it); | 111 s_pluginErrors.erase(it); |
112 } | 112 } |
113 } | 113 } |
114 s_criticalSectionQueue.Unlock(); | 114 s_criticalSectionQueue.Unlock(); |
115 | 115 |
116 return hasError; | 116 return hasError; |
117 } | 117 } |
OLD | NEW |