Show the content of the message info from the failure exception
This commit is contained in:
parent
231c9f86c4
commit
65779731fd
@ -23,6 +23,8 @@ using Polly;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
@ -1058,13 +1060,27 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void ShowErrorDialog(string message, string caption)
|
private void ShowErrorDialog(string message, string caption)
|
||||||
{
|
{
|
||||||
|
// Example:
|
||||||
|
// Error calling ShipcallUpdate: {\"message\": \"PUT Requests for shipcalls can only be issued by an assigned AGENCY or BSMD users
|
||||||
|
// (if the special-flag is enabled). Assigned Agency: ShipcallParticipantMap(id=628, shipcall_id=115, participant_id=10,
|
||||||
|
// type=8, created=datetime.datetime(2024, 8, 28, 15, 13, 14), modified=None) with Flags: 42\"}
|
||||||
|
Match m = Regex.Match(message, "\\{(.*)\\}");
|
||||||
|
if ((m != null) && (m.Success))
|
||||||
|
{
|
||||||
|
dynamic? msg = JsonConvert.DeserializeObject(m.Value);
|
||||||
|
if(msg != null)
|
||||||
|
{
|
||||||
|
message = msg.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_log.ErrorFormat("{0} - {1}", caption, message);
|
_log.ErrorFormat("{0} - {1}", caption, message);
|
||||||
/*
|
|
||||||
Dispatcher.Invoke(new Action(() =>
|
Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}));
|
}));
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnableControlsForParticipant()
|
private void EnableControlsForParticipant()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user