|
@@ -49,7 +49,7 @@ glm::vec4 parseColor( std::string value ) {
|
49
|
49
|
found[3] = 1;
|
50
|
50
|
}
|
51
|
51
|
} catch ( ... ) {
|
52
|
|
- throw new std::invalid_argument("Unable to parse value `" + valuecopy + "` as a color. Should be in the format r,g,b or r,g,b,a. Like 1,1,1,1.");
|
|
52
|
+ throw std::invalid_argument("Unable to parse value `" + valuecopy + "` as a color. Should be in the format r,g,b or r,g,b,a. Like 1,1,1,1.");
|
53
|
53
|
}
|
54
|
54
|
return found;
|
55
|
55
|
}
|
|
@@ -102,7 +102,7 @@ SlopOptions* getOptions( cxxopts::Options& options ) {
|
102
|
102
|
if ( options.count( "nodecorations" ) > 0 ) {
|
103
|
103
|
foo->nodecorations = options["nodecorations"].as<int>();
|
104
|
104
|
if ( foo->nodecorations < 0 || foo->nodecorations > 2 ) {
|
105
|
|
- throw new std::invalid_argument( "--nodecorations must be between 0 and 2. Or be used as a flag." );
|
|
105
|
+ throw std::invalid_argument( "--nodecorations must be between 0 and 2. Or be used as a flag." );
|
106
|
106
|
}
|
107
|
107
|
}
|
108
|
108
|
return foo;
|
|
@@ -113,7 +113,7 @@ std::string formatOutput( std::string input, SlopSelection selection ) {
|
113
|
113
|
for( unsigned int i=0;i<input.length();i++) {
|
114
|
114
|
if ( input[i] == '%' ) {
|
115
|
115
|
if ( input.length() <= i+1 ) {
|
116
|
|
- throw new std::invalid_argument( "Expected character after `%`, got END." );
|
|
116
|
+ throw std::invalid_argument( "Expected character after `%`, got END." );
|
117
|
117
|
}
|
118
|
118
|
switch( input[i+1] ) {
|
119
|
119
|
case 'x':
|
|
@@ -132,7 +132,7 @@ std::string formatOutput( std::string input, SlopSelection selection ) {
|
132
|
132
|
case 'i':
|
133
|
133
|
case 'I': output << selection.id; break;
|
134
|
134
|
case '%': output << "%"; break;
|
135
|
|
- default: throw new std::invalid_argument( std::string()+"Expected x, y, w, h, g, i, c, or % after % in format. Got `" + input[i+1] + "`." );
|
|
135
|
+ default: throw std::invalid_argument( std::string()+"Expected x, y, w, h, g, i, c, or % after % in format. Got `" + input[i+1] + "`." );
|
136
|
136
|
}
|
137
|
137
|
i++;
|
138
|
138
|
continue;
|
|
@@ -242,7 +242,7 @@ int app( int argc, char** argv ) {
|
242
|
242
|
// Options just validates all of our input from argv
|
243
|
243
|
auto& positional = options["positional"].as<std::vector<std::string>>();
|
244
|
244
|
if ( positional.size() > 0 ) {
|
245
|
|
- throw new std::invalid_argument("Unexpected positional argument: " + positional[0]);
|
|
245
|
+ throw std::invalid_argument("Unexpected positional argument: " + positional[0]);
|
246
|
246
|
}
|
247
|
247
|
bool help = false;
|
248
|
248
|
if ( options.count( "help" ) > 0 ) {
|
|
@@ -297,8 +297,8 @@ int app( int argc, char** argv ) {
|
297
|
297
|
int main( int argc, char** argv ) {
|
298
|
298
|
try {
|
299
|
299
|
return app( argc, argv );
|
300
|
|
- } catch( std::exception* e ) {
|
301
|
|
- std::cerr << "Slop encountered an error:\n" << e->what() << "\n";
|
|
300
|
+ } catch( std::exception& e ) {
|
|
301
|
+ std::cerr << "Slop encountered an error:\n" << e.what() << "\n";
|
302
|
302
|
return 1;
|
303
|
303
|
} // let the operating system handle any other kind of exception.
|
304
|
304
|
return 1;
|