d04014ced6609382319b578bd684da887f3bd4cb
[reactos.git] / reactos / tools / rbuild / exception.cpp
1
2 #include "pch.h"
3
4 #include "rbuild.h"
5
6 using std::string;
7
8 Exception::Exception ()
9 {
10 }
11
12 Exception::Exception ( const string& message )
13 {
14 Message = message;
15 }
16
17 Exception::Exception ( const char* format,
18 ...)
19 {
20 va_list args;
21 va_start ( args,
22 format);
23 Message = ssvprintf ( format,
24 args);
25 va_end ( args );
26 }
27
28 void Exception::SetMessage ( const char* message,
29 va_list args)
30 {
31 Message = ssvprintf ( message,
32 args);
33 }
34
35
36 InvalidOperationException::InvalidOperationException ( const char* filename,
37 const int linenumber)
38 {
39 Message = ssprintf ( "%s:%d",
40 filename,
41 linenumber );
42 }
43
44
45 FileNotFoundException::FileNotFoundException ( const string& filename )
46 : Exception ( "File '%s' not found.",
47 filename.c_str() )
48 {
49 Filename = filename;
50 }
51
52
53 AccessDeniedException::AccessDeniedException ( const string& filename)
54 : Exception ( "Access denied to file '%s'.",
55 filename.c_str() )
56 {
57 Filename = filename;
58 }
59
60
61 InvalidBuildFileException::InvalidBuildFileException ( const char* message,
62 ...)
63 {
64 va_list args;
65 va_start ( args,
66 message );
67 SetMessage ( message,
68 args );
69 va_end ( args );
70 }
71
72 InvalidBuildFileException::InvalidBuildFileException ()
73 {
74 }
75
76
77 XMLSyntaxErrorException::XMLSyntaxErrorException ( const string& location,
78 const char* message,
79 ... )
80 {
81 va_list args;
82 va_start ( args,
83 message );
84 Message = location + ": " + ssvprintf ( message, args );
85 va_end ( args );
86 }
87
88
89 RequiredAttributeNotFoundException::RequiredAttributeNotFoundException ( const string& attributeName,
90 const string& elementName )
91 : InvalidBuildFileException ( "Required attribute '%s' not found on '%s'.",
92 attributeName.c_str (),
93 elementName.c_str ())
94 {
95 }
96
97 InvalidAttributeValueException::InvalidAttributeValueException ( const string& name,
98 const string& value )
99 : InvalidBuildFileException ( "Attribute '%s' has an invalid value '%s'.",
100 name.c_str (),
101 value.c_str () )
102 {
103
104 }
105
106 BackendNameConflictException::BackendNameConflictException ( const string& name )
107 : Exception ( "Backend name conflict: '%s'",
108 name.c_str() )
109 {
110 }
111
112
113 UnknownBackendException::UnknownBackendException ( const string& name )
114 : Exception ( "Unknown Backend requested: '%s'",
115 name.c_str() )
116 {
117 }