Skip to content

Commit

Permalink
Added new exception handling (#2461)
Browse files Browse the repository at this point in the history
* Test space added

* Exception handler was added to catch AccessDeniedException while trying to create TestResults folder

* Remove unnecessary space

* Deleted unnecessary test. Changed console message and corrected folder path in that message

* Remove unnecessary dot

* Removed unnecessary lines and usings and coreccted exception message

* Removed unnecessary line

* Updating resource files

* New exception handling was added

* Formatted exception message
  • Loading branch information
Sanan07 authored and nohwnd committed Jun 12, 2020
1 parent 2474ad2 commit df62aca
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ private bool RunTestInternalWithExecutors(IEnumerable<Tuple<Uri, string>> execut
var exceptionsHitDuringRunTests = false;
var executorsFromDeprecatedLocations = false;
double totalTimeTakenByAdapters = 0;

foreach (var executorUriExtensionTuple in executorUriExtensionMap)
{
// Get the executor from the cache.
Expand Down Expand Up @@ -530,7 +531,11 @@ private bool RunTestInternalWithExecutors(IEnumerable<Tuple<Uri, string>> execut
totalTimeTakenByAdapters += totalTimeTaken.TotalSeconds;
}
catch (Exception e)
{
{
string exceptionMessage = (e is UnauthorizedAccessException)
? string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.AccessDenied, e.Message)
: ExceptionUtilities.GetExceptionMessage(e);

exceptionsHitDuringRunTests = true;

if (EqtTrace.IsErrorEnabled)
Expand All @@ -547,7 +552,7 @@ private bool RunTestInternalWithExecutors(IEnumerable<Tuple<Uri, string>> execut
CultureInfo.CurrentCulture,
CrossPlatEngineResources.ExceptionFromRunTests,
executorUriExtensionTuple.Item1,
ExceptionUtilities.GetExceptionMessage(e)));
exceptionMessage));
}
finally
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,7 @@
<data name="AttachDebuggerToDefaultTestHostFailure" xml:space="preserve">
<value>Cannot attach the debugger to the default test host with process ID: {0}.</value>
</data>
<data name="AccessDenied" xml:space="preserve">
<value>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Ladicí program se nedá připojit k výchozímu hostiteli testů s ID procesu {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Der Debugger kann nicht an den Standardtesthost mit der Prozess-ID {0} angefügt werden.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">No se puede asociar el depurador al host de prueba predeterminado con el id. de proceso: {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Impossible d'attacher le débogueur à l'hôte de test par défaut ayant l'ID de processus : {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Non è possibile collegare il debugger all'host di test predefinito con ID processo {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">デバッガーをプロセス ID: {0} の既定のテスト ホストにアタッチできません。</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">프로세스 ID가 {0}인 기본 테스트 호스트에 디버거를 연결할 수 없습니다.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Nie można dołączyć debugera do domyślnego hosta testowego z identyfikatorem procesu: {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Não é possível anexar o depurador ao host de teste padrão com a ID de processo: {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Не удается подключить отладчик к узлу тестирования по умолчанию с идентификатором процесса {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">Hata ayıklayıcı, {0} işlem kimliğine sahip varsayılan test ana bilgisayarına eklenemiyor.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
<target state="new">Cannot attach the debugger to the default test host with process ID: {0}.</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">无法将调试程序附加到进程 ID 为“{0}”的默认测试主机。</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
<target state="translated">無法將偵錯工具連結到處理序識別碼為 {0} 的預設測試主機。</target>
<note></note>
</trans-unit>
<trans-unit id="AccessDenied">
<source>{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges.</source>
<target state="new">{0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. For more information, please look at the error message:</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit df62aca

Please sign in to comment.