[CommonError] Add common errors and utility functions
[platform/core/csapi/tizen.git] / Tizen.Internals / Tizen.Internals.Errors / ErrorFacts.cs
1 /// Copyright 2016 by Samsung Electronics, Inc.,
2 ///
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
8
9
10 using System;
11 using System.Runtime.InteropServices;
12
13 namespace Tizen.Internals.Errors
14 {
15     /// <summary>
16     /// 
17     /// </summary>
18     public static class ErrorFacts
19     {
20         /// <summary>
21         /// 
22         /// </summary>
23         /// <returns></returns>
24         public static int GetLastResult()
25         {
26             return Interop.CommonError.GetLastResult();
27         }
28
29         /// <summary>
30         /// 
31         /// </summary>
32         /// <param name="errorCode"></param>
33         /// <returns></returns>
34         public static string GetErrorMessage(int errorCode)
35         {
36             IntPtr errorPtr = Interop.CommonError.GetErrorMessage(errorCode);
37             return Marshal.PtrToStringAuto(errorPtr);
38         }
39     }
40 }