Skip to content

Commit

Permalink
Replaced EXIT(1) with EXIT(EXIT_FAILURE).
Browse files Browse the repository at this point in the history
  • Loading branch information
rukletsov committed Mar 24, 2016
1 parent e1c9ec4 commit 1a9fd2a
Show file tree
Hide file tree
Showing 21 changed files with 308 additions and 233 deletions.
6 changes: 4 additions & 2 deletions src/examples/balloon_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_PRINCIPAL");
if (value.isNone()) {
EXIT(1) << "Expecting authentication principal in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication principal in the environment";
}

Credential credential;
Expand All @@ -249,7 +250,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_SECRET");
if (value.isNone()) {
EXIT(1) << "Expecting authentication secret in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication secret in the environment";
}

credential.set_secret(value.get());
Expand Down
6 changes: 4 additions & 2 deletions src/examples/docker_no_executor_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ int main(int argc, char** argv)

Option<string> value = os::getenv("DEFAULT_PRINCIPAL");
if (value.isNone()) {
EXIT(1) << "Expecting authentication principal in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication principal in the environment";
}

Credential credential;
Expand All @@ -197,7 +198,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_SECRET");
if (value.isNone()) {
EXIT(1) << "Expecting authentication secret in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication secret in the environment";
}

credential.set_secret(value.get());
Expand Down
2 changes: 1 addition & 1 deletion src/examples/load_generator_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class LoadGeneratorScheduler : public Scheduler
{
// Terminating process with EXIT here because we cannot interrupt
// LoadGenerator's long-running loop.
EXIT(1) << "Error received: " << error;
EXIT(EXIT_FAILURE) << "Error received: " << error;
}

private:
Expand Down
6 changes: 4 additions & 2 deletions src/examples/long_lived_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_PRINCIPAL");
if (value.isNone()) {
EXIT(1) << "Expecting authentication principal in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication principal in the environment";
}

Credential credential;
Expand All @@ -204,7 +205,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_SECRET");
if (value.isNone()) {
EXIT(1) << "Expecting authentication secret in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication secret in the environment";
}

credential.set_secret(value.get());
Expand Down
10 changes: 6 additions & 4 deletions src/examples/test_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ int main(int argc, char** argv)
if (load.isError()) {
cerr << load.error() << endl;
usage(argv[0], flags);
exit(1);
exit(EXIT_FAILURE);
} else if (master.isNone()) {
cerr << "Missing --master" << endl;
usage(argv[0], flags);
exit(1);
exit(EXIT_FAILURE);
}

internal::logging::initialize(argv[0], flags, true); // Catch signals.
Expand Down Expand Up @@ -262,7 +262,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_PRINCIPAL");
if (value.isNone()) {
EXIT(1) << "Expecting authentication principal in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication principal in the environment";
}

Credential credential;
Expand All @@ -272,7 +273,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_SECRET");
if (value.isNone()) {
EXIT(1) << "Expecting authentication secret in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication secret in the environment";
}

credential.set_secret(value.get());
Expand Down
6 changes: 4 additions & 2 deletions src/examples/test_http_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ int main()

value = os::getenv("MESOS_FRAMEWORK_ID");
if (value.isNone()) {
EXIT(1) << "Expecting 'MESOS_FRAMEWORK_ID' to be set in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting 'MESOS_FRAMEWORK_ID' to be set in the environment";
}
frameworkId.set_value(value.get());

value = os::getenv("MESOS_EXECUTOR_ID");
if (value.isNone()) {
EXIT(1) << "Expecting 'MESOS_EXECUTOR_ID' to be set in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting 'MESOS_EXECUTOR_ID' to be set in the environment";
}
executorId.set_value(value.get());

Expand Down
20 changes: 11 additions & 9 deletions src/examples/test_http_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class HTTPScheduler : public process::Process<HTTPScheduler>
}

default: {
EXIT(1) << "Received an UNKNOWN event";
EXIT(EXIT_FAILURE) << "Received an UNKNOWN event";
}
}
}
Expand Down Expand Up @@ -292,11 +292,12 @@ virtual void initialize()
if (status.state() == TASK_LOST ||
status.state() == TASK_KILLED ||
status.state() == TASK_FAILED) {
EXIT(1) << "Exiting because task " << status.task_id()
<< " is in unexpected state " << status.state()
<< " with reason " << status.reason()
<< " from source " << status.source()
<< " with message '" << status.message() << "'";
EXIT(EXIT_FAILURE)
<< "Exiting because task " << status.task_id()
<< " is in unexpected state " << status.state()
<< " with reason " << status.reason()
<< " from source " << status.source()
<< " with message '" << status.message() << "'";
}

if (tasksFinished == totalTasks) {
Expand Down Expand Up @@ -395,11 +396,11 @@ int main(int argc, char** argv)
if (load.isError()) {
cerr << load.error() << endl;
usage(argv[0], flags);
EXIT(1);
EXIT(EXIT_FAILURE);
} else if (master.isNone()) {
cerr << "Missing --master" << endl;
usage(argv[0], flags);
EXIT(1);
EXIT(EXIT_FAILURE);
}

process::initialize();
Expand Down Expand Up @@ -428,7 +429,8 @@ int main(int argc, char** argv)

value = os::getenv("DEFAULT_PRINCIPAL");
if (value.isNone()) {
EXIT(1) << "Expecting authentication principal in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting authentication principal in the environment";
}

framework.set_principal(value.get());
Expand Down
19 changes: 11 additions & 8 deletions src/executor/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class MesosProcess : public ProtobufProcess<MesosProcess>
Try<Nothing> load = flags.load("MESOS_");

if (load.isError()) {
EXIT(1) << "Failed to load flags: " << load.error();
EXIT(EXIT_FAILURE) << "Failed to load flags: " << load.error();
}

// Initialize libprocess.
Expand All @@ -183,7 +183,8 @@ class MesosProcess : public ProtobufProcess<MesosProcess>
// Get agent PID from environment.
value = os::getenv("MESOS_SLAVE_PID");
if (value.isNone()) {
EXIT(1) << "Expecting 'MESOS_SLAVE_PID' to be set in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting 'MESOS_SLAVE_PID' to be set in the environment";
}

UPID upid(value.get());
Expand Down Expand Up @@ -212,8 +213,8 @@ class MesosProcess : public ProtobufProcess<MesosProcess>

recoveryTimeout = _recoveryTimeout.get();
} else {
EXIT(1) << "Expecting 'MESOS_RECOVERY_TIMEOUT' to be set in the "
<< "environment";
EXIT(EXIT_FAILURE)
<< "Expecting 'MESOS_RECOVERY_TIMEOUT' to be set in the environment";
}

// Get maximum backoff factor from environment.
Expand All @@ -227,8 +228,9 @@ class MesosProcess : public ProtobufProcess<MesosProcess>

maxBackoff = _maxBackoff.get();
} else {
EXIT(1) << "Expecting 'MESOS_SUBSCRIPTION_BACKOFF_MAX' to be set "
<< "in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting 'MESOS_SUBSCRIPTION_BACKOFF_MAX' to be set"
<< " in the environment";
}
}

Expand All @@ -243,8 +245,9 @@ class MesosProcess : public ProtobufProcess<MesosProcess>

shutdownGracePeriod = _shutdownGracePeriod.get();
} else {
EXIT(1) << "Expecting 'MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD' to be set "
<< "in the environment";
EXIT(EXIT_FAILURE)
<< "Expecting 'MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD' to be set"
<< " in the environment";
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/jvm/jvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ void Jvm::check(JNIEnv* env)
if (env->ExceptionCheck() == JNI_TRUE) {
if (!exceptions) {
env->ExceptionDescribe();
EXIT(1) << "Caught a JVM exception, not propagating";
EXIT(EXIT_FAILURE) << "Caught a JVM exception, not propagating";
} else {
java::lang::Throwable throwable;
Object* object = &throwable;
Expand Down
8 changes: 4 additions & 4 deletions src/launcher/fetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ int main(int argc, char* argv[])
Try<string> fetched =
fetch(item, cacheDirectory, sandboxDirectory, frameworksHome);
if (fetched.isError()) {
EXIT(1) << "Failed to fetch '" << item.uri().value()
<< "': " + fetched.error();
EXIT(EXIT_FAILURE)
<< "Failed to fetch '" << item.uri().value() << "': " + fetched.error();
} else {
LOG(INFO) << "Fetched '" << item.uri().value()
<< "' to '" << fetched.get() << "'";
Expand All @@ -470,8 +470,8 @@ int main(int argc, char* argv[])
fetcherInfo.get().user(),
sandboxDirectory);
if (chowned.isError()) {
EXIT(1) << "Failed to chown " << sandboxDirectory
<< ": " << chowned.error();
EXIT(EXIT_FAILURE)
<< "Failed to chown " << sandboxDirectory << ": " << chowned.error();
}
}

Expand Down
Loading

0 comments on commit 1a9fd2a

Please sign in to comment.