Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
84f480b1
Commit
84f480b1
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
More mail notifications handled by the logger.
Refers to
#3
parent
4d3c0b57
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AutoTx/AutoTx.cs
+6
-25
6 additions, 25 deletions
AutoTx/AutoTx.cs
with
6 additions
and
25 deletions
AutoTx/AutoTx.cs
+
6
−
25
View file @
84f480b1
...
...
@@ -199,10 +199,7 @@ namespace AutoTx
_roboCommand
=
new
RoboCommand
();
}
catch
(
Exception
ex
)
{
// FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error in LoadSettings(): {0}\n{1}"
,
ex
.
Message
,
ex
.
StackTrace
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Error
(
"LoadSettings() failed: {0}\n{1}"
,
ex
.
Message
,
ex
.
StackTrace
);
throw
new
Exception
(
"Error in LoadSettings."
);
}
// NOTE: this is explicitly called *outside* the try-catch block so an Exception
...
...
@@ -210,7 +207,6 @@ namespace AutoTx
CheckConfiguration
();
}
/// <summary>
/// Load the configuration xml file.
/// </summary>
...
...
@@ -227,16 +223,12 @@ namespace AutoTx
throw
new
Exception
(
"Error validating configuration."
);
}
catch
(
Exception
ex
)
{
// FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error loading configuration XML: {0}"
,
ex
.
Message
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Error
(
"loading configuration XML failed: {0}"
,
ex
.
Message
);
// this should terminate the service process:
throw
new
Exception
(
"Error loading config."
);
}
}
/// <summary>
/// Load the status xml file.
/// </summary>
...
...
@@ -247,17 +239,13 @@ namespace AutoTx
Log
.
Debug
(
"Loaded status from [{0}]"
,
_pathToStatus
);
}
catch
(
Exception
ex
)
{
// FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error loading status XML from [{0}]: {1} {2}"
,
Log
.
Error
(
"loading status XML from [{0}] failed: {1} {2}"
,
_pathToStatus
,
ex
.
Message
,
ex
.
StackTrace
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
// this should terminate the service process:
throw
new
Exception
(
"Error loading status."
);
}
}
/// <summary>
/// Check if loaded configuration is valid, print a summary to the log.
/// </summary>
...
...
@@ -280,12 +268,8 @@ namespace AutoTx
// then set it to false while the service is running until it is properly
// shut down via the OnStop() method:
if
(
_status
.
CleanShutdown
==
false
)
{
// FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"WARNING: {0} was not shut down properly last time!\n\n"
+
"This could indicate the computer has crashed or was forcefully shut off."
,
ServiceName
);
Log
.
Warn
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Error
(
"WARNING: {0} was not shut down properly last time!\n\nThis could "
+
"indicate the computer has crashed or was forcefully shut off."
,
ServiceName
);
}
_status
.
CleanShutdown
=
false
;
...
...
@@ -327,10 +311,7 @@ namespace AutoTx
}
}
catch
(
Exception
ex
)
{
// FIXME: combine log and admin-email!
var
warn
=
string
.
Format
(
"GraceLocationSummary() failed: {0}"
,
ex
.
Message
);
Log
.
Warn
(
warn
);
SendAdminEmail
(
warn
);
Log
.
Error
(
"GraceLocationSummary() failed: {0}"
,
ex
.
Message
);
}
Log
.
Debug
(
msg
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment