1 //===-- DNBError.cpp --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Created by Greg Clayton on 6/26/07.
12 //===----------------------------------------------------------------------===//
17 #include "PThreadMutex.h"
19 #ifdef WITH_SPRINGBOARD
20 #include <SpringBoardServices/SpringBoardServer.h>
24 DNBError::AsString() const
35 s = ::mach_error_string (m_err);
39 s = ::strerror (m_err);
42 #ifdef WITH_SPRINGBOARD
45 CFStringRef statusStr = SBSApplicationLaunchingErrorString (m_err);
46 if (CFString::UTF8 (statusStr, m_str) == NULL)
54 // You have to call ObjC routines to get the error string from BackBoardServices.
55 // Not sure I want to make DNBError.cpp an .mm file. For now just make sure you
56 // pre-populate the error string when you make the DNBError of type BackBoard.
57 m_str.assign("Should have set BackBoard error when making the error string.");
64 // You have to call ObjC routines to get the error string from FrontBoardServices.
65 // Not sure I want to make DNBError.cpp an .mm file. For now just make sure you
66 // pre-populate the error string when you make the DNBError of type FrontBoard.
67 m_str.assign("Should have set FrontBoard error when making the error string.");
83 DNBError::LogThreadedIfError(const char *format, ...) const
89 va_start (args, format);
90 ::vasprintf (&arg_msg, format, args);
95 const char *err_str = AsString();
98 DNBLogThreaded ("error: %s err = %s (0x%8.8x)", arg_msg, err_str, m_err);
105 DNBError::LogThreaded(const char *format, ...) const
107 char *arg_msg = NULL;
109 va_start (args, format);
110 ::vasprintf (&arg_msg, format, args);
117 const char *err_str = AsString();
120 DNBLogThreaded ("error: %s err = %s (0x%8.8x)", arg_msg, err_str, m_err);
124 DNBLogThreaded ("%s err = 0x%8.8x", arg_msg, m_err);