Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Mapping / ViewGeneration / Utils / ExceptionHelpers.cs
1 //---------------------------------------------------------------------
2 // <copyright file="ExceptionHelpers.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner [....]
7 // @backupOwner [....]
8 //---------------------------------------------------------------------
9
10 using System.Text;
11 using System.Data.Mapping.ViewGeneration.Structures;
12 using System.Diagnostics;
13 using System.Data.Common.Utils;
14
15 namespace System.Data.Mapping.ViewGeneration.Utils
16 {
17
18     // Miscellaneous helper routines for generating mapping exceptions
19     internal static class ExceptionHelpers
20     {
21         internal static void ThrowMappingException(ErrorLog.Record errorRecord, ConfigViewGenerator config)
22         {
23             InternalMappingException exception = new InternalMappingException(errorRecord.ToUserString(), errorRecord);
24             if (config.IsNormalTracing)
25             {
26                 exception.ErrorLog.PrintTrace();
27             }
28             throw exception;
29         }
30
31         internal static void ThrowMappingException(ErrorLog errorLog, ConfigViewGenerator config)
32         {
33             InternalMappingException exception = new InternalMappingException(errorLog.ToUserString(), errorLog);
34             if (config.IsNormalTracing)
35             {
36                 exception.ErrorLog.PrintTrace();
37             }
38             throw exception;
39         }
40     }
41 }