Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: installer/src/installer-lib/session.cpp

Issue 6197445574787072: Cleaned up CA exceptions. Integrated free-standing handle class. (Closed)
Patch Set: Created March 30, 2014, 7:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * \file session.cpp Implementation of Session class. 2 * \file session.cpp Implementation of Session class.
3 */ 3 */
4 4
5 #include "installer-lib.h"
5 #include "session.h" 6 #include "session.h"
6 #include "property.h" 7 #include "property.h"
7 #include "msiquery.h" 8 #include "msiquery.h"
8 9
9 // Temporary for debugging
10 #include <sstream>
11
12
13 //------------------------------------------------------------------------------ ----------- 10 //------------------------------------------------------------------------------ -----------
14 // Message 11 // Message
15 //------------------------------------------------------------------------------ ----------- 12 //------------------------------------------------------------------------------ -----------
16 Message::Message( std::string message, INSTALLMESSAGE message_type ) 13 Message::Message( std::string message, INSTALLMESSAGE message_type )
17 : r( 1 ), message_type( message_type ) 14 : r( 1 ), message_type( message_type )
18 { 15 {
19 r.assign_string( 0, message ) ; 16 r.assign_string( 0, message ) ;
20 } 17 }
21 18
22 Message::Message( std::wstring message, INSTALLMESSAGE message_type ) 19 Message::Message( std::wstring message, INSTALLMESSAGE message_type )
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void Session::log_noexcept( std::string message ) 71 void Session::log_noexcept( std::string message )
75 { 72 {
76 write_message_noexcept( Log_Message( log_prefix + message ) ) ; 73 write_message_noexcept( Log_Message( log_prefix + message ) ) ;
77 } 74 }
78 75
79 int Session::write_message( Message & m ) 76 int Session::write_message( Message & m )
80 { 77 {
81 int x = write_message_noexcept( m ) ; 78 int x = write_message_noexcept( m ) ;
82 if ( x == -1 ) 79 if ( x == -1 )
83 { 80 {
84 DWORD z = ::GetLastError(); 81 throw windows_api_error( "MsiProcessMessage", x, "attempt to write to log fi le" ) ;
85 std::ostringstream s ;
86 s << "Error writing message. err = 0x" << std::hex << z ;
87 throw std::runtime_error( s.str() ) ;
88 } 82 }
89 return x ; 83 return x ;
90 } 84 }
91 85
92 int Session::write_message_noexcept( Message & m ) 86 int Session::write_message_noexcept( Message & m )
93 { 87 {
94 return MsiProcessMessage( handle, m.message_type, m.r.handle() ) ; 88 return MsiProcessMessage( handle, m.message_type, m.r.handle() ) ;
95 } 89 }
96 90
97 //------------------------------------------------------------------------------ ----------- 91 //------------------------------------------------------------------------------ -----------
98 // Immediate_Session 92 // Immediate_Session
99 //------------------------------------------------------------------------------ ----------- 93 //------------------------------------------------------------------------------ -----------
100 Immediate_Session::Immediate_Session( MSIHANDLE handle, std::string name ) 94 Immediate_Session::Immediate_Session( MSIHANDLE handle, std::string name )
101 : Session( handle, name ) 95 : Session( handle, name )
102 {} 96 {}
OLDNEW

Powered by Google App Engine
This is Rietveld