/
HandleExceptions.cs
38 lines (37 loc) · 1.14 KB
/
HandleExceptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Aspose.Tasks.Examples.CSharp.Miscellaneous
{
class HandleExceptions
{
public static void Run()
{
// ExStart:HandleExceptions
Project project;
try
{
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
project = new Project(dataDir + "project.mpp");
}
catch (TasksReadingException ex)
{
Console.WriteLine("Message:");
Console.WriteLine(ex.Message);
Console.WriteLine("Log:");
Console.WriteLine(ex.LogText);
if (ex.InnerException != null)
{
Console.WriteLine("Inner exception message:");
Console.WriteLine(ex.InnerException.Message);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// ExEnd:HandleExceptions
}
}
}