Implement exception handling and reporting.

- NEU: Fehlerbehandlung und Fehlerberichte.
This commit is contained in:
Daniel Kraus 2015-07-27 22:14:18 +02:00
parent b4f3d81336
commit 81619edcb1
5 changed files with 70 additions and 1 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "www/PHPMailer"]
path = www/PHPMailer
url = git@github.com:PHPMailer/PHPMailer.git

1
www/PHPMailer Submodule

@ -0,0 +1 @@
Subproject commit 1193eb9d280f046fb3726c0124ea171f216328fd

53
www/postreport.php Normal file
View File

@ -0,0 +1,53 @@
<?php
require(__DIR__ . '/PHPMailer/PHPMailerAutoload.php');
$reportId = $_POST['report_id'];
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'nephrowiki.de';
$mail->Username = 'zaareloaded@nephrowiki.de';
$mail->Password = 'ooZ1eiJa';
// $mail->SMTPSecure = 'tls';
$mail->Port = 25;
$mail->From = 'zaareloaded@nephrowiki.de';
$mail->FromName = 'zaaReloaded';
$mail->addAddress('dk@doktorkraus.de');
$mail->Subject = "[zaaReloaded] Exception $reportId";
if ( $_POST['ccUser'] ) {
$validMail = filter_var( $_POST['usersMail'], FILTER_VALIDATE_EMAIL );
$validUser = filter_var( $_POST['usersName'], FILTER_SANITIZE_STRING );
if ( $validUser ) {
$validUser = "\"$validUser\" "; // space character deliberately placed
};
if ( $validMail ) {
$mail->addCC($validMail, $validUser);
};
};
$info = print_r( $_POST, true );
$mail->Body = <<<EOF
zaaReloaded exception
User's comment on submission:
{$_POST['comment']}
***
Technical details: $info
--
http://zaa.nephrowiki.de
EOF;
if ($mail->send())
{
// Must return the report ID to indicate success
echo($reportId);
}
else
{
echo($mail->ErrorInfo);
}

View File

@ -34,7 +34,7 @@
<i:Interaction.Triggers>
<i:EventTrigger SourceObject="{Binding ViewDetailsMessage}" EventName="Sent">
<i:EventTrigger.Actions>
<actions:ShowViewAction Assembly="zaaReloaded2" View="XLToolbox.ExceptionHandler.ExceptionDetailView" />
<actions:ShowViewAction Assembly="zaaReloaded2" View="zaaReloaded2.ExceptionHandler.ExceptionDetailView" />
</i:EventTrigger.Actions>
</i:EventTrigger>
<i:EventTrigger SourceObject="{Binding SubmitReportMessage}" EventName="Sent">

View File

@ -26,6 +26,7 @@ using Office = Microsoft.Office.Core;
using Microsoft.Office.Tools.Word;
using Bovender.Versioning;
using Bovender.Mvvm.Messaging;
using zaaReloaded2.ExceptionHandler;
namespace zaaReloaded2
{
@ -46,6 +47,7 @@ namespace zaaReloaded2
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Bovender.ExceptionHandler.CentralHandler.ManageExceptionCallback += CentralHandler_ManageExceptionCallback;
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
@ -108,6 +110,16 @@ namespace zaaReloaded2
#endregion
#region Exception handler
void CentralHandler_ManageExceptionCallback(object sender, Bovender.ExceptionHandler.ManageExceptionEventArgs e)
{
e.IsHandled = true;
ExceptionViewModel vm = new ExceptionViewModel(e.Exception);
vm.InjectInto<ExceptionView>().ShowDialog();
}
#endregion
#region Private fields
Ribbon _ribbon;