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
d6c30951
Commit
d6c30951
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Sending emails on errors is now handled by the logger.
Therefore the corresponding code can be simplified a lot. Refers to
#3
parent
ecf825ac
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
+7
-25
7 additions, 25 deletions
AutoTx/AutoTx.cs
with
7 additions
and
25 deletions
AutoTx/AutoTx.cs
+
7
−
25
View file @
d6c30951
...
...
@@ -350,10 +350,8 @@ namespace AutoTx
_mainTimer
.
Enabled
=
true
;
}
catch
(
Exception
ex
)
{
// FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error in OnStart(): {0}"
,
ex
.
Message
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Error
(
"Error in OnStart(): {0}"
,
ex
.
Message
);
throw
;
}
// read the build timestamp from the resources:
...
...
@@ -384,10 +382,7 @@ namespace AutoTx
_roboCommand
.
Stop
();
}
catch
(
Exception
ex
)
{
// FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error terminating the RoboCopy process: {0}"
,
ex
.
Message
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Error
(
"Error terminating the RoboCopy process: {0}"
,
ex
.
Message
);
}
_status
.
TransferInProgress
=
true
;
Log
.
Info
(
"Not all files were transferred - will resume upon next start"
);
...
...
@@ -717,7 +712,6 @@ namespace AutoTx
/// </summary>
private
void
MoveToManagedLocation
(
DirectoryInfo
userDir
)
{
string
errMsg
;
string
logMsg
;
// TODO / FIXME: cleanup var after fixing mail-logging
try
{
// first check for individual files and collect them:
CollectOrphanedFiles
(
userDir
);
...
...
@@ -728,10 +722,7 @@ namespace AutoTx
// if the user has no directory on the destination move to UNMATCHED instead:
if
(
string
.
IsNullOrWhiteSpace
(
DestinationPath
(
userDir
.
Name
)))
{
// TODO / FIXME: combine log and admin-email!
logMsg
=
string
.
Format
(
"Found unmatched incoming dir: {0}"
,
userDir
.
Name
);
Log
.
Error
(
logMsg
);
SendAdminEmail
(
logMsg
);
Log
.
Error
(
"Found unmatched incoming dir: {0}"
,
userDir
.
Name
);
target
=
"UNMATCHED"
;
}
...
...
@@ -749,10 +740,7 @@ namespace AutoTx
catch
(
Exception
ex
)
{
errMsg
=
ex
.
Message
;
}
// TODO / FIXME: combine log and admin-email!
logMsg
=
string
.
Format
(
"MoveToManagedLocation({0}) failed: {1}"
,
userDir
.
FullName
,
errMsg
);
Log
.
Error
(
logMsg
);
SendAdminEmail
(
logMsg
);
Log
.
Error
(
"MoveToManagedLocation({0}) failed: {1}"
,
userDir
.
FullName
,
errMsg
);
}
/// <summary>
...
...
@@ -787,10 +775,7 @@ namespace AutoTx
catch
(
Exception
ex
)
{
errMsg
=
ex
.
Message
;
}
// TODO / FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"MoveToGraceLocation() failed: {0}"
,
errMsg
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Error
(
"MoveToGraceLocation() failed: {0}"
,
errMsg
);
}
/// <summary>
...
...
@@ -836,11 +821,8 @@ namespace AutoTx
}
}
catch
(
Exception
ex
)
{
// TODO / FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error moving directories: [{0}] > [{1}]\n{2}"
,
Log
.
Error
(
"Error moving directories: [{0}] > [{1}]\n{2}"
,
sourceDir
.
FullName
,
destPath
,
ex
.
Message
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
return
false
;
}
return
true
;
...
...
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