diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 195701024..982a9b4c2 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -227,7 +227,8 @@ main( int argc, char* argv[] ) cError() << "Job #" << count << "failed" << TR( "summary", r.message() ) << TR( "details", r.details() ); - ++failure_count; + if ( r.errorCode() > 0 ) + ++failure_count; } ++count; } diff --git a/src/libcalamares/Job.cpp b/src/libcalamares/Job.cpp index ded0aecc3..d2118451f 100644 --- a/src/libcalamares/Job.cpp +++ b/src/libcalamares/Job.cpp @@ -71,7 +71,7 @@ JobResult::ok() JobResult JobResult::error( const QString& message, const QString& details ) { - return JobResult( message, details, -1 ); + return JobResult( message, details, GenericError ); } JobResult diff --git a/src/libcalamares/Job.h b/src/libcalamares/Job.h index eb685ff81..04b4560a4 100644 --- a/src/libcalamares/Job.h +++ b/src/libcalamares/Job.h @@ -29,6 +29,13 @@ namespace Calamares { class DLLEXPORT JobResult { public: + /** @brief Distinguish classes of errors + * + * All "ok result" have errorCode 0 (NoError). + * Errors returned from job execution have values < 0. + * Errors before job execution, or not returned by the job execution + * itself, have values > 0. + */ enum { NoError = 0, @@ -49,6 +56,8 @@ public: virtual QString details() const; virtual void setDetails( const QString& details ); + int errorCode() const { return m_number; } + /// @brief an "ok status" result static JobResult ok(); /// @brief an "error" result resulting from the execution of the job